#include <bits/stdc++.h>
using namespace std;
bool possible(int smaller, int bigger) { return (bigger <= smaller * 3 + 1); }
int main() {
  ios::sync_with_stdio(false);
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int b, w;
    cin >> b >> w;
    if ((b < w && !possible(b, w)) || (w < b && !possible(w, b))) {
      cout << "NO" << endl;
      continue;
    }
    cout << "YES" << endl;
    int offset = (b < w) ? 1 : 0;
    if (b < w) swap(b, w);
    int column = 1;
    while (w + 1 < b) {
      cout << column << " " << (2 + offset) << endl;
      column++;
      cout << column << " " << (1 + offset) << endl;
      cout << column << " " << (2 + offset) << endl;
      cout << column << " " << (3 + offset) << endl;
      column++;
      w -= 1;
      b -= 3;
    }
    if (w < b) {
      cout << column << " " << (2 + offset) << endl;
      b--;
      column++;
    }
    for (; 0 < b; b--) {
      cout << column << " " << (1 + offset) << endl;
      cout << column << " " << (2 + offset) << endl;
      column++;
    }
  }
}
