#include <bits/stdc++.h>
using namespace std;
void pr(int a, int b) { cout << a << ' ' << b << '\n'; }
void solve(int ad, int a, int b) {
  int d = a - b + 1;
  if (d - 2 - (b)*2 > 0) {
    cout << "NO\n";
    return;
  }
  cout << "YES\n";
  for (int i = 2; i <= 2 * b; ++i) {
    cout << 2 << ' ' << ad + i << '\n';
  }
  d = a - b + 1;
  if (d) {
    cout << 2 << ' ' << ad + 1 << '\n';
    d--;
  }
  if (d) {
    cout << 2 << ' ' << ad + 2 * b + 1 << '\n';
    d--;
  }
  for (int i = 2; i <= 2 * b && d; i += 2) {
    cout << 1 << ' ' << i + ad << '\n';
    d--;
  }
  for (int i = 2; i <= b * 2 && d; i += 2) {
    cout << 3 << ' ' << i + ad << '\n';
    d--;
  }
}
signed main() {
  int q;
  cin >> q;
  while (q--) {
    int b, w;
    cin >> b >> w;
    if (b == w) {
      cout << "YES\n";
      for (int i = 1; i <= b + w; ++i) {
        cout << 1 << ' ' << i << '\n';
      }
      continue;
    } else if (w > b) {
      solve(1, w, b);
    } else
      solve(0, b, w);
  }
  return 0;
}
