#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	freopen("factory.in", "r", stdin);
	freopen("factory.out", "w", stdout);
	int t, b, a;
	scanf("%d", &t);
	while (t--)
	{
        scanf("%d%d", &a, &b);
      	int cnt = 0;
      	while (a != b && cnt++ < 50)
      		if (a > b) a -= b, b += b; else b -= a, a += a;
      	printf(a == b ? "YES\n" : "NO\n");
	}	
}