#include <bits/stdc++.h>
using namespace std;
int minswaps(string s) {
  int best = 0;
  map<char, int> m1, m2;
  string s1, s2;
  for (int i = 0; i < s.size() / 2; i++) {
    m1[s[i]]++;
    s1 += s[i];
  }
  for (int i = s.size() / 2; i < s.size(); i++) {
    m2[s[i]]++;
    s2 += s[i];
  }
  int nswaps = 0;
  for (auto x : s1) {
    if (m1[x] != (m1[x] + m2[x]) / 2) {
      nswaps++;
    }
  }
  nswaps /= 2;
  for (auto &x : s1) {
    if (m1[x] != (m1[x] + m2[x]) / 2 && nswaps) {
      for (auto &c : s2) {
        if (m2[c] != (m1[c] + m2[c]) / 2 && x != c) {
          swap(x, c);
          best++;
          break;
        }
      }
      nswaps--;
    }
  }
  assert(s1.size() == s2.size());
  int cache[s1.size()];
  int n = s2.size();
  for (int i = 0; i < s1.size(); i++) {
    if (i == 0) {
      if (s1[i] != s2[n - 1 - i])
        cache[i] = 1;
      else
        cache[i] = 0;
      continue;
    }
    if (s1[i] != s2[n - i - 1])
      cache[i] = cache[i - 1] + 1;
    else
      cache[i] = cache[i - 1];
  }
  return cache[s1.size() - 1] / 2 + best;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long holes = ((n - 1) * m) + ((m - 1) * n);
    if (holes > (n * m))
      cout << "NO"
           << "\n";
    else
      cout << "YES"
           << "\n";
  }
}
