#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;

#define int long long int
#define double long double

#define all(x) begin(x), end(x)
#define Done(x) cout<<x<<endl; return;
#define endl '\n'

void solve(){
	int q; cin>>q;
	for(int i=0;i<q;i++){
		int u; cin>>u;
		int v; cin>>v;
		if(v<u){
			cout<<"NO"<<endl;
		}else if(v==u){
			cout<<"YES"<<endl;
		}else{
			vector<int>cnt(31);
			for(int i=0;i<30;i++){
				if(u&(1<<i)){
					cnt[i]++;
				}
			}
			bool can=true;
			for(int i=0;i<30;i++){
				int val=(1<<i);
				if(v&val){
					if(cnt[i]==0){
						can=false;
						break;
					}else{
						cnt[i]-=1;
						cnt[i+1]+=cnt[i];
					}
				}else{
					cnt[i+1]+=cnt[i];
				}
			}
			if(can){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}
	}
}

int32_t main(){
	// Remove for Interactive Problems
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	solve();
	
	cerr<<"Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";
	return 0;
}