#include <bits/stdc++.h>
using namespace std;
bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }
void solve() {
  long long n, m;
  cin >> n >> m;
  if (n == 1 || m == 1) {
    cout << "YES" << '\n';
    return;
  }
  if (n != m) {
    cout << "NO" << '\n';
    return;
  }
  if (n == 2) {
    cout << "YES" << '\n';
    return;
  }
  cout << "NO" << '\n';
}
signed main() {
  cin.tie(NULL), ios_base::sync_with_stdio(false), cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
