require 'prime' A, B = gets.split.map(&:to_i).sort if A == 1 if B == 1 puts 'Yes' else puts 'No' end exit end if B % A != 0 puts 'No' exit end a = A b = B c = 0 while b > 1 && b >= a && b % a == 0 b /= a c += 1 end if b == 1 && A * c == B puts 'Yes' else puts 'No' end