/*
  Author     : MatsuTaku
  Date         : 02/28/21
  Certificate:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDF9T447OEo8XSQ6O1AznN5tKC8mzvYc4Zs3+oOKfMqgLXfOwQnpfcoxKs4MAP1eICBD13PkcIezJ9IlV6nKQZKs1BQmvjSXJ+zKK8YCKvAueNPuNO0Bim43IBaNHNFWcMvcmUvHgRb6hUSO0V8I7OsjiFo20KDBj3gAznu9tir0Q== CompetitiveProgrammingCertification:tkm.matsumoto@gmail.com
*/

#include <bits/stdc++.h>
using namespace std;
#include <x86intrin.h>
#define REP(i, f, n)      for (int i = (f), i##_len = (n); i < i##_len; i++)
#define rep(i, n)         REP(i, 0, n)
#define RREP(i, f, n)     for (int i = (n)-1, i##_left = (f); i >= i##_left; i--)
#define rrep(i, n)        RREP(i, 0, n)
using lint = long long int;
using ulint = unsigned long long int;
template<typename T>
using vvec = vector<vector<T>>;
template<typename T>
vvec<T> make_vvec(int n, int m, T v) { return vvec<T>(n, vector<T>(m, v)); }
template<typename T>
T& chmax(T& dst, T x) { return dst = max(dst, x); }
template<typename T>
T& chmin(T& dst, T x) { return dst = min(dst, x); }

class Solver {
 public:
  Solver();
  void solve();
};

Solver::Solver() {}

void Solver::solve() {
  int q; cin>>q;
  while (q--) {
    int u,v; cin>>u>>v;
    bool ans = u <= v;
    int uc = 0, vc = 0;
    rep(i, 31) {
      if ((1<<i) & u)
        uc++;
      if ((1<<i) & v)
        vc++;
      ans &= uc >= vc;
    }
    cout << (ans ? "YES" : "NO") << endl;
  }
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  Solver solver;
  int t = 1;
//  cin>>t;
  while (t--) {
    solver.solve();
  }
  return 0;
}
