#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q, b, w, x, y, k;
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> b >> w;
    if (max(w, b) > min(w, b) * 3 + 1)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      y = 2, x = 2;
      if (b < w) x = 3;
      for (; y - 1 <= min(b, w) * 2; y++) cout << x << " " << y << endl;
      x--, y = 2, k = abs(b - w);
      for (; y - 1 <= min(k * 2 - 1, min(b, w) * 2 - 1); y += 2)
        cout << x << " " << y << endl;
      x += 2, y = 2, k = k - min(b, w);
      if (k > 0) {
        for (; y - 1 <= min(k * 2 - 1, min(b, w) * 2 - 1); y += 2)
          cout << x << " " << y << endl;
        if (k - min(b, w) > 0) cout << (x - 1) << " " << 1 << endl;
      }
    }
  }
  return 0;
}
