//#include<bits/stdc++.h>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define _for(i,a,b) for(int i = (a); i <  (b); ++i)
#define _rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define _per(i,a,b) for(int i = (a); i >= (b); --i)
#define dbg(x...) do { cout << #x << " -> "; err(x); } while (0)
void err () {	cout << endl;}
template <class T, class... Ts>
void err(const T& arg, const Ts&... args) {
    cout << arg << ' '; err(args...);}

inline int rd () {
   int s = 0, w = 1;
   char ch = getchar();
   while(ch < '0' || ch > '9'){if(ch == '-') w = -1; ch = getchar();}
   while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
   return s * w;
}

typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 5e3 + 10;

int a[maxn];
ll dp[maxn];

void run () {
	int a = rd(), b = rd();
	
	if (a > b) return (void)(printf("NO\n"));
	
	vector<int> aa, bb;
	
	_rep (i, 0, 30) {
		if (1 & (a >> i)) aa.push_back(i);
		if (1 & (b >> i)) bb.push_back(i);
	}
	
	if (aa.size() < bb.size()) return (void)(printf("NO\n"));
	
	_for (i, 0, bb.size()) {
		if (aa[i] > bb[i]) return (void)(printf("NO\n"));
	}
	
	printf("YES\n");
}

int main () {
	int _T = rd();
	while (_T--) run();
    return 0;
}
