#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int b, w;
    cin >> b >> w;
    int start;
    std::vector<int> on;
    std::vector<int> tw;
    std::vector<int> tr;
    if (b < w) {
      start = 2;
      w--;
    } else {
      start = 3;
      b--;
    }
    int m = min(b, w);
    tw.push_back(start);
    int cur = start;
    for (int i = (0); i < (m); i++) {
      cur += 1;
      tw.push_back(cur);
      cur += 1;
      tw.push_back(cur);
      b--;
      w--;
    }
    if (b > 0) {
      for (int i = (start); i < (cur + 1); i++) {
        if (i % 2 == 0) {
          if (b > 0) {
            on.push_back(i);
            b--;
          }
          if (b > 0) {
            tr.push_back(i);
            b--;
          }
        }
      }
    }
    if (w > 0) {
      for (int i = (start); i < (cur + 1); i++) {
        if (i % 2 == 1) {
          if (w > 0) {
            on.push_back(i);
            w--;
          }
          if (w > 0) {
            tr.push_back(i);
            w--;
          }
        }
      }
    }
    int flag = 0;
    if (b == 0) {
      if (w == 0) {
        flag = 1;
      }
    }
    if (flag) {
      cout << "YES\n";
      for (int i = (0); i < (on.size()); i++) {
        cout << 1 << " " << on[i] << "\n";
      }
      for (int i = (0); i < (tw.size()); i++) {
        cout << 2 << " " << tw[i] << "\n";
      }
      for (int i = (0); i < (tr.size()); i++) {
        cout << 3 << " " << tr[i] << "\n";
      }
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
