#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef long double ld;
#define pb push_back
#define MAXN 200005
#define INF (ll)1e18
#define mod 1000000007 
//#define mod 998244353
#define endl '\n'
#define level 20
ll cc=0;
 
 
void boost()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}


 
int main()
{
    boost();
 
    ll i,j,k,t,x,y,n,ans1,c=0,mask,v;
    ll h,u,q,w,m,mm,mx,l,z,ans,r;
    ld f;
    
    cin>>q;
    
    
    while(q--)
    {
        cin>>u>>v;
        ll b[30],b1[30];
        
        
        for(i=0;i<30;i++)
        {
            b[i]=0;
            b1[i]=0;
        }
        
        
        if(u>v)
        {
            cout<<"NO"<<endl;
        }
        
        else if(u==v)
        {
            cout<<"YES"<<endl;
        }
        
        else
        {
            l=0;
            r=0;
            for(i=0;i<30;i++)
            {
                if((1LL<<i)&u)
                {
                    b[i]++;
                }
                
                if((1LL<<i)&v)
                {
                    b1[i]++;
                }
            }
            
            c=0;
            
            
            for(i=0;i<30;i++)
            {
                if(b[i]>0)
                {
                    l++;
                }
                
                if(b1[i]>0)
                {
                    r++;
                }
                
                if(r>l)
                {
                    c++;
                    break;
                }
                
            }
            
            if(c>0)
            {
                cout<<"NO"<<endl;
            }
            
            else
            cout<<"YES"<<endl;
            
        }
    }
    
    
    
return 0;
}