#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define endl "\n"
#define INF 0x3f3f3f3f
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
#define pri_que_less priority_queue<int,vector<int>,less<int> >
#define pri_que_greater priority_queue <int,vector<int>,greater<int> >
#define Debug(in) cout<<#in<<"="<<(in)<<endl
using namespace std;
template<typename T>inline void read(T &a){char c=getchar();T x=0,f=1;while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=(x<<1)+(x<<3)+c-'0';c=getchar();}a=f*x;}
ll qpow(ll a,ll n,ll mod){ll ans=1,base=a%mod;while(n){if(n&1)ans=(ans*base)%mod;base=(base*base)%mod;n>>=1;}return ans;}

int U[35], V[35];
int main() {
	int q;
	cin >> q;
	while (q--) {
		ll u, v;
		cin >> u >> v;
		if (u == v) {
			cout << "YES" << endl;
			continue;
		}		
		if (u > v) {
			cout << "NO" << endl;
			continue;
		}
		for (int i = 0; i <= 30; i++)
			U[i] = (u >> i) & 1;
		for (int i = 1; i <= 30; i++)
			U[i] += U[i-1];
		for (int i = 0; i <= 30; i++)
			V[i] = (v >> i) & 1;
		for (int i = 1; i <= 30; i++)
			V[i] += V[i-1];
		int flag = 1;
		for (int i = 0; i <= 30; i++) {
			if (U[i] < V[i]) {
				flag = 0;
				break;
			}
		}
		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}


	return 0;
}
