#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int b, w;
    cin >> b >> w;
    if (b >= w) {
      if (b > 3 * w + 1)
        cout << "NO\n";
      else {
        cout << "YES\n";
        int i = 2;
        for (int j = 2; j <= 2 * w + 1; ++j) {
          cout << i << " " << j << "\n";
        }
        if (b >= w + 1) cout << 2 << " " << 1 << "\n";
        b -= w + 1;
        for (int j = 2; j <= 2 * w && b > 0; j += 2) {
          cout << i - 1 << " " << j << "\n";
          --b;
          if (b > 0) {
            cout << i + 1 << " " << j << "\n";
            --b;
          } else
            break;
        }
      }
    } else {
      if (w > 3 * b + 1)
        cout << "NO\n";
      else {
        cout << "YES\n";
        int i = 3;
        for (int j = 2; j <= 2 * b + 1; ++j) {
          cout << i << " " << j << "\n";
        }
        if (w >= b + 1) cout << 3 << " " << 1 << "\n";
        w -= b + 1;
        for (int j = 2; j <= 2 * b && w > 0; j += 2) {
          cout << i - 1 << " " << j << "\n";
          --w;
          if (w > 0) {
            cout << i + 1 << " " << j << "\n";
            --w;
          } else
            break;
        }
      }
    }
  }
}
