#include <queue>
#include <vector>
#include<iostream>
#include<map>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<bits/stdc++.h>

#define rep(i,a,b)  for( int i(a); i <= b; ++i)
#define ll long long
#define inf 1e15
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define PI acos(-1)
#define fi first
#define se second
#define pb push_back
#define debug(x)   printf("x=%d\n",x);
#define ls(x) arr[x].child[0]
#define rs(x) arr[x].child[1]
#define PI acos(-1)
using namespace std;

const int N=1e6+7;
const ll mod=1e9+7;

inline ll read()
{
    ll X=0; bool flag=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
    while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
    if(flag) return X;
    return ~(X-1);
}


ll n,k,m;
ll ar[N],br[N];
ll ans;

int bc[N],ac[N];
vector<int>vt[5];
void solvve()
{
    ll a=read(),b=read();
   // if(a>b) swap(a,b);
   if(a>b) {cout<<"NO"<<endl; return;}
   int cnt1=0,cnt2=0;
    rep(i,0,32)
    {
        if(a&(1<<i)) cnt1++;
        if(b&(1<<i)) cnt2++;
        if(cnt2)
        {
            if(!cnt1){cout<<"NO"<<endl; return;}

            else
            {
                cnt1--; cnt2--;
            }
        }

    }

    cout<<"YES"<<endl;
    //else cout<<"NO"<<endl;
}
int main()
{

    // freopen("input","r",stdin);

      //  while(scanf("%lld",&n)!=EOF)

        int T;    T=read();while(T--)
    {
        //printf("cas=%d   ",++cc);
        solvve();
    }
    return 0;


}
