#include<bits/stdc++.h>
#define ff first
#define ss second
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define pb push_back
using namespace std;

void setIO(string name) 
{ 
	ios_base::sync_with_stdio(0); 
    cin.tie(0);
	if (name.size()) 
    {
		freopen((name+".in").c_str(), "r", stdin);
		freopen((name+".out").c_str(), "w", stdout);
    }
}

bool check(int u, int v)
{
    int f1 = 0;
    vector<int>a(31, 0), b(31, 0);
    int i = 0;
    while(u)
    {
        a[i] = u % 2;
        u /= 2;
        i++;
    }
    i = 0;
    while(v)
    {
        b[i] = v % 2;
        v /= 2;
        i++;
    }
    i = 0;
    while(i < 31)
    {
        f1 += a[i];
        if(b[i])
        {
            if(f1 == 0)
                return 0;
            f1--;
        }
        i++;
    }
    return 1;
}
void solve()
{
    int u, v;
    cin >> u >> v;
    if(u > v)
    {
        cout << "NO\n";
        return;
    }
    if(check(u, v))
    {
        cout << "YES\n";
    }
    else cout << "NO\n";
}

int main()
{
    setIO("");
    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
}
