#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <climits>
#include <set>
#include <iomanip>
#include <numeric>
#include <queue>
#include <stack>
#include <bits/stdc++.h>

using namespace std;

#define ff first
#define ss second
#define int long long
#define ld long double
#define pb push_back
#define mt make_tuple
#define pii pair<int, int>
#define vi vector<int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define mod 1000000007
#define inf 1e18
#define all(v) (v).begin(), (v).end()
#define ps(x, y) fixed << setprecision(y) << x
#define setbits(x) __builtin_popcountll(x)
#define mk(arr, n, type) type *arr = new type[n];
#define FIO                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define endl "\n"

int32_t main()
{
    FIO;
    int t;
    t = 1;
    cin >> t;
    while (t--)
    {
        int u,v;
        cin>>u>>v;
        if(u>v || setbits(v)> setbits(u)){
            cout<<"NO\n";
        }
        else{
            vi setu(32,0), setv(32,0);
            for(int i=0;i<32;i++){
                setu[i]=(u%2);
                setv[i]=(v%2);
                u/=2;
                v/=2;
            }
            int tillu=0,tillv=0;
            int ans=1;
            for(int i=0;i<32;i++){
                tillv+=setv[i];
                tillu+=setu[i];
                if(tillv>tillu){
                    ans=0;
                    break;
                }
            }
            if(ans){
                cout<<"YES\n";
            }
            else{
                cout << "NO\n";
            }
        }
    }
    return 0;
}