rw [←Nat.div_eq_iff_eq_mul_left (by simp) hdvd2,
    Nat.mul_div_assoc (3^(n-q))
      (by rw [pow_dvd_pow_iff (by simp) (by simp)]; exact h₁),
    Nat.pow_div h₁ (by simp)] at hfac
m n q p : ℕ
h₁ : p ≤ m
h₂ : q ≤ n
hfac : 3 ^ (n - q) * 2 ^ m = 1 * 2 ^ p
hdvd3 : 3 ^ q ∣ 2 ^ m * 3 ^ n
hdvd2 : 2 ^ p ∣ 3 ^ (n - q) * 2 ^ m
⊢ m = p ∧ n = q
m n q p : ℕ
h₁ : p ≤ m
h₂ : q ≤ n
hfac : 3 ^ (n - q) * 2 ^ (m - p) = 1
hdvd3 : 3 ^ q ∣ 2 ^ m * 3 ^ n
hdvd2 : 2 ^ p ∣ 3 ^ (n - q) * 2 ^ m
⊢ m = p ∧ n = q