#include<bits/stdc++.h>
using namespace std;

#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define mem(a) memset(a, 0, sizeof(a))

const int MAXN=2e5+5;
int t, n, m;

int a[2][100];

int get(int x, int k) {
	int now = 0;
	while(x) {
		a[k][++now] = x & 1;
		x >>= 1;
	}
	return now;
}

int main(void){
	IO;
	cin >> t;
	while(t--) {
		cin >> n >> m;
		if(n > m) {
			cout << "NO" << '\n';
		}else {
			int len1 = get(n, 0), len2 = get(m, 1);
			int jg = 1;
			for(int i = len2; i >= 1; i--) {
				if(a[1][i]) {
					int flag = 0;
					int now = min(i, len1);
					while(now > 0) {
						if(a[0][now]) {
							a[0][now] = 0;
							now--;
							flag = 1;
							break;
						}
						now--;
					}
					if(!flag) {
						jg = 0;
						break;
					}
				}
			}
			if(jg) cout << "YES" << '\n';
			else cout << "NO" << '\n';
		}
	}
}

