#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;}
template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;}
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
#define out(x) "{" << (#x) << ": " << x << "} "

const ll MAX_N = 5e3 + 10;

void solve() {
    int a, b;
    cin >> a >> b;
    if(b < a) {cout << "NO" << endl; return;}
    int bank = 0, cap = false;
    while(a + b > 0) {
        if(a & 1) {bank ++; cap = true;}
        if(b & 1) {bank --; cap = false;}
        if(bank < 0) {cout << "NO" << endl; return;}
        a /= 2;
        b /= 2;
    }
    if(cap) {cout << "NO" << endl; return;}
    cout << "YES" << endl;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t;
    cin >> t;
    while(t --) {
        solve();
    }
    return 0;
}

