#include <iostream>

using namespace std;

void solve()
{
    int a, b;
    cin>>a>>b;
    if(a>b) cout<<"NO\n";
    else
    {
        for(int mask = 1<<30; mask>0; mask>>=1)
            if((a&mask) && (a+mask <= b))
        {
            a+=mask;
            mask = 1<<30;
        }
        if(a==b) cout<<"YES\n";
        else cout<<"NO\n";
    }
}

int main()
{
    int q;
    cin>>q;
    while(q--)
        solve();
    return 0;
}
