/*
 * Author: Demid Kucherenko (NRU ITMO)
 */
import java.util.*;
import java.io.*;

public class factory_dk {

	long gcd(long a, long b) {
		if (a > b) return(gcd(b,a));
		if (a == 0) {
			return b;
		}
		return gcd(b % a, a);
	}
	
	void solve() throws IOException {
		int n = nextInt();
		for (int i = 0; i < n; i++) {
		long a = nextLong();
		long b = nextLong();
		long count = (a + b) / gcd(a, b);
		while (count % 2 == 0) {
			count /= 2;
		}
		if (count == 1) {
			out.println("YES");
		} else {
			out.println("NO");
		}                            
		}
	}

	void run() throws IOException {
		br = new BufferedReader(new FileReader("factory.in"));
		out = new PrintWriter("factory.out");
		solve();
		br.close();
		out.close();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer stok;

	String nextToken() throws IOException {
		while (stok == null || !stok.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null) {
				return null;
			}
			stok = new StringTokenizer(s);
		}
		return stok.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	char nextChar() throws IOException {
		return (char) (br.read());
	}

	String nextLine() throws IOException {
		return br.readLine();
	}

	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		new factory_dk().run();
	}
}