import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int a = sc.nextInt(); int b = sc.nextInt(); int[] mods = new int[10]; int idx = 0; int value = 1000000000; while (idx < 10) { if (isPrime(value)) { mods[idx++] = value; } value++; } for (int i = 0; i < 10; i++) { if (powmod(a, b, mods[i]) != powmod(b, a, mods[i])) { System.out.println("No"); return; } } System.out.println("Yes"); } static long powmod(long x, int p, int mod) { if (p == 0) { return 1; } else if (p % 2 == 0) { return powmod(x * x % mod, p / 2, mod); } else { return powmod(x, p - 1, mod) * x % mod; } } static boolean isPrime(int x) { for (int i = 2; i <= Math.sqrt(x); i++) { if (x % i == 0) { return false; } } return true; } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }