#include<bits/stdc++.h>
using namespace std;

typedef long long int in;

int main()
{
   in t;
   cin>>t;

   lol:
   while(t--)
   {
      in u,v;
      cin>>u>>v;

      if(u==v)
      {
         cout<<"Yes\n";
         goto lol;
      }
      else if(u>v)
      {
         cout<<"No\n";
         goto lol;
      }

      in i,j,cu=0,cv=0;

      for(i=0;i<30;++i)
      {
         if((1<<i)&u)
         ++cu;

         if((1<<i)&v)
         ++cv;
      }

      if(cv>cu)
      {
         cout<<"No\n";
         goto lol;
      }

      for(i=0;i<30;++i)
      if((1<<i)&v)
      {
         in c=1;

         for(j=i;j>=0;--j)
         if((1<<j)&u)
         {
            u-=(1<<j);
            c=0;
            break;
         }

         if(c)
         {
            cout<<"NO\n";
            goto lol;
         }
      }

      cout<<"YES\n";
   }
   
   return 0;
}