#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int lsb(int x) {
	for(int i = 0; i <= 30; ++i) {
		if(x & (1 << i)) {
			return i;
		}
	}
	return -1;
}

void solve() {
	int u, v;
	cin >> u >> v;
	if(v < u) {
		cout << "NO" << endl;
		return;
	}
	for(int i = 0; i <= 30; ++i) {
		int v_lsb = lsb(v);
		int u_lsb = lsb(u);

		if(v == 0) {
			cout << "YES" << endl;
			return;
		}

		if(u_lsb > v_lsb || u_lsb == -1) {
			cout << "NO" << endl;
			return;
		} else {
			u = u & ~(1 << u_lsb);
			v = v & ~(1 << v_lsb);
		}
	}

}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  cin >> tc;
  while(tc--) {
    solve();
  }
}
