#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  cin >> T;
  while (T--) {
    bool flag = true, cond = true;
    long long n, i, j, x, y = 0, ind, k, m, dif, mn = INT_MAX, p = 0, mx = 0,
                          count = 0, diff, y1;
    long long c = 0;
    cin >> n >> m;
    if (n == 1 || (n == 2 && m == 2) || m == 1)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}
