def gi gets.chomp.to_i end def gm gets.chomp.split.map(&:to_i) end def gc gets.chomp end def gs gets.chomp.split end require 'prime' def factorize(n) factors = [] primes = Prime.each(Math.sqrt(n).to_i) primes.each do |p| while n % p == 0 factors << p n /= p end end factors << n if n > 1 factors end def check_if_solvable(n) factors = factorize(n) return false if factors.empty? p = factors.uniq[0] q = factors.uniq[1] a = factors.count(p) b = factors.count(q) return p && q && a >= 0 && b >= 0 end N = gi if check_if_solvable(N) puts "Yes" else puts "No" end