#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

int q, u, v;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> q;
    for(int i = 0; i < q; i++)
    {
        cin >> u >> v;
        int bad = 0;
        vector<int> posu, posv;
        for(int k = 0; k < 30; k++)
        {
            if(u & (1ll << k))
                posu.push_back(k);
            if(v & (1ll << k))
                posv.push_back(k);
        }
        if(posu.size() < posv.size())
            bad = 1;
        if(!bad)
        {
            for(int k = 0; k < posv.size(); k++)
                if(posu[k] > posv[k])
                    bad = 1;
        }
        if(u <= v && !bad)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}