#include<fstream>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<functional>
#include<numeric>
#include<bitset>
#include<cassert>
#include<array>
#include "string.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define mp make_pair

namespace
{
	bool can()
	{
		ull u, v; cin >> u >> v;

		if (v < u) return false;
		int bu(0), bv(0);
		for (; v>0; u/=2, v/=2)
		{
			bu += (u & 1);
			bv += (v & 1);
			if (bu < bv) return false;
		}

		return true;
	}
}

int main()
{
	ios::sync_with_stdio(0);
	int zzz; cin >> zzz;
	for (int zz = 0; zz < zzz; ++zz)
	{
		bool ret = can();
		cout << (ret ? "YES" : "NO") << endl;
	}
	
	return 0;
}
