#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int LINF = 0x3f3f3f3f3f3f3f;
const long long int M = 1000000007;
int t, n, m;
void solve() {
  if ((n == m && m == 2) || n == 1 || m == 1)
    cout << ("YES") << endl;
  else
    cout << ("NO") << endl;
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    solve();
  }
  return 0;
}
