#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        int u, v; cin >> u >> v;
        if (u > v)
            printf("NO\n");
        else if (u == v)
            printf("YES\n");
        else {
            int U = 0, V = 0, fail = 0;
            // (u) 1 0111 0111 -> 1 1010 0110 (v)
            // bit0: {0, 1, 2, 4, 5, 6, 8} -> bit1: {1, 2, 5, 7, 8}
            for (int i = 0; i < 30; i++) {
                U += u >> i & 1;
                V += v >> i & 1;
                fail |= U < V;
            }
            printf(fail ? "NO\n" : "YES\n");
        }
    }
    return 0;
}
/*
3 12
YES
6 9
NO
*/
