#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, m;
  for (cin >> t; t > 0; --t) {
    cin >> n >> m;
    cout << (min(m, n) == 1 || (m == 2 && n == 2) ? "YES" : "NO") << endl;
  }
  return 0;
}
