#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
    long long q;
    cin>>q;
    while(q--)
    {
        long long u,v;
        cin>>u>>v;
        if(u>v)
        {
            cout<<"NO"<<endl;
            continue;
        }
        string s1,s2;
        for(long long i = 31;i>=0;i--)
        {
            long long num = 1<<i;
            if((num&u)!=0)
            s1+='1';
            else
            s1+='0';
            if((num&v)!=0)
            s2+='1';
            else
            s2+='0';
        }
        vector <long long> v1,v2;
        for(long long i = 0;i<s1.size();i++)
        {
            if(s1[i]=='1')
            v1.push_back(i);
            if(s2[i]=='1')
            v2.push_back(i);
        }
            long long f = 0;
            long long i = v1.size()-1,j = v2.size()-1;
            while(i>=0 && j>=0)
            {
                if(v1[i]<v2[j])
                {
                    f=1;
                    break;
                }
                else
                {j--;
                i--;}
            }
            if(j!=-1)
            f=1;
            if(v2[0]>v1[0])
            f=1;
            if(f==1)
            cout<<"NO"<<endl;
            else
            cout<<"YES"<<endl;
    }
}