#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
int main() {
  fast();
  long long a, b, c, w, d, x, y, z, n, m, i, j;
  long long k, p, q, h, f, r, l, u;
  string t, s = "", s1 = "", s2 = "", s3 = "";
  cin >> q;
  for (int ii = 0; ii < q; ii++) {
    cin >> b >> w;
    if (b <= w) {
      if (b * 3 + 1 < w) {
        cout << "NO\n";
        continue;
      }
      cout << "YES\n";
      x = 2, y = 3;
      for (i = 0; i < b * 2 - 1; i++) {
        cout << x << " " << y + i << endl;
      }
      w -= b - 1;
      if (w) {
        for (i = 0; i < min(b, w); i++) {
          cout << x - 1 << " " << y + i * 2 << endl;
        }
        w = max(w - b, 0LL);
      }
      if (w) {
        for (i = 0; i < min(b, w); i++) {
          cout << x + 1 << " " << y + i * 2 << endl;
        }
        w = max(w - b, 0LL);
      }
      if (w > 0) cout << "2 2\n";
      if (w > 1) cout << "2 " << y + b * 2 - 1 << endl;
    } else {
      swap(w, b);
      if (b * 3 + 1 < w) {
        cout << "NO\n";
        continue;
      }
      cout << "YES\n";
      x = 2, y = 2;
      for (i = 0; i < b * 2 - 1; i++) {
        cout << x << " " << y + i << endl;
      }
      w -= b - 1;
      if (w) {
        for (i = 0; i < min(b, w); i++) {
          cout << x - 1 << " " << y + i * 2 << endl;
        }
        w = max(w - b, 0LL);
      }
      if (w) {
        for (i = 0; i < min(b, w); i++) {
          cout << x + 1 << " " << y + i * 2 << endl;
        }
        w = max(w - b, 0LL);
      }
      if (w > 0) cout << "2 1\n";
      if (w > 1) cout << "2 " << y + b * 2 - 1 << endl;
    }
  }
  return 0;
}
