#include <bits/stdc++.h>

using namespace std;
#define fast	ios::sync_with_stdio(0);cin.tie(0);
#define ll	long long int
#define INFL    1e18L
#define INF     2e9
#define nl     	'\n'
#define ld	long double
#define precision(x)	fixed << setprecision(x)
// const ll mod = 998244353;
const ll mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	if (b == 0)  return a;
	return gcd(b , a % b);
}


ll powm(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * 1LL * a) % mod;
		b >>= 1LL;
		a = (a * 1LL * a) % mod;
	}
	return res;
}
const int N = 1e5 + 5;
const int M = 70;


//--------------------------------------------------------------------------------------------------------------------------//


void solve() {
	int q;
	cin >> q;

	while (q--) {
		ll u, v;
		cin >> u >> v;
		bool ans = 1;
		if (u > v || (__builtin_popcount(u) < __builtin_popcount(v))) {
			cout << "NO" << nl;
			continue;
		}
		bool cnt = 0;
		for (int i = 30; i >= 0; i--) {
			ll bu = (u & (1ll << i));
			ll bv = (v & (1ll << i));

			if (bv > 0 && bu == 0) {
				bool b = 0;
				for (int j = i - 1; j >= 0; j--) {
					if (u & (1ll << j)) {
						u -= (1ll << j);
						cnt = 1;
						u |= (1ll << i);
						b = 1;
						break;
					}
				}
				if (!b) ans = 0;
			} else if (bv == 0 && bu > 0) {
				if (!cnt) {
					ans = 0;
				}
			}
		}

		cout << (ans ? "YES" : "NO") << nl;
	}
}


int main() {
	fast
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int tc = 1;
	// cin >> tc;
	int _ = 0;
	while (_++ < tc) {
		solve();
	}
	return 0;
}
