//#pragma GCC optimize(2)
#include<bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr)
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define lc(x) ((x)<<1)
#define rc(x) (((x)<<1)|1)


using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
 
const ll LINF=1e18;
const ll MOD=998244353;
const int INF=0x3f3f3f3f;
const int MAXM=200050;
const int MAXN=5050;
//35000

void mainwork(int T){
	int l,r,ll,rr;
	scanf("%d%d",&l,&r);
	ll=l,rr=r;
	if(l>r){
		puts("NO");
		return;
	}else if(l==r){
		puts("YES");
		return;
	}
	int cntl=0,cntr=0;
	while(l){
		if(l&1){
			cntl++;
		}
		l>>=1;
	}
	while(r){
		if(r&1){
			cntr++;
		}
		r>>=1;
	}
	if(cntl<cntr){
		puts("NO");
		return;
	}
	int cnt=0;
	l=ll,r=rr;
	while(l||r){
		if(l&1){
			cnt++;
		}
		if(r&1){
			cnt--;
		}
		if(cnt<0){
			puts("NO");
			return;
		}
		l>>=1;
		r>>=1;
	}
	puts("YES");
}
signed main(){
	//IOS;
	#ifndef ONLINE_JUDGE
	//freopen("./in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	#endif
	int t=1;
	scanf("%d",&t);
	//prework();
	for(int i=1;i<=t;i++){
		mainwork(i);
	}
}