#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX5 100005
#define MAX6 1000006
#define MAX7 10000007
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define sfs(a) scanf("%s", a)
#define sline(a) scanf("%[^\n]%*c", a);
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define pfs(a) printf("%s\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mod 1000000007
#define Mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

inline int Set(ll N, ll pos){return N=N | (1LL<<pos);}
inline int Reset(ll N, ll pos){return N=N & ~(1LL<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

const int N = MAX5;

int main()
{
    //#ifndef ONLINE_JUDGE
    //    freopen("in.txt","r",stdin);
    //    freopen("out.txt","w",stdout);
    //#endif

    FASTIO;
    int T;
    cin>>T;
    while(T--) {
        int u, v;
        cin>>u>>v;
        if(u > v) {
            cout<<"NO"<<endl;
        }
        else {
            int cnt = 0;
            bool flag = true;
            for(int i = 0; i < 30; i++) {
                if(Check(u, i)) cnt++;
                if(Check(v, i)) cnt--;
                if(cnt < 0) flag = false;
            }
            if(flag) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
    }
    
    return 0;
}
