#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int b, w;
    cin >> b >> w;
    vector<pair<int, int>> res;
    bool need = b < w;
    if (need) swap(w, b);
    int x = 2, y = 2;
    while (w > 0) {
      if ((x + y) % 2 == 1) {
        res.push_back({x, y});
        --b;
      } else {
        res.push_back({x, y});
        --w;
      }
      ++y;
    }
    int cx = 1, cy = 2;
    while (b > 0 && cy <= y) {
      res.push_back({cx, cy});
      --b;
      cy += 2;
    }
    cx = 3, cy = 2;
    while (b > 0 && cy <= y) {
      res.push_back({cx, cy});
      --b;
      cy += 2;
    }
    if (b > 0) {
      res.push_back({2, 1});
      --b;
    }
    if (b > 0) {
      res.push_back({2, y});
      --b;
    }
    if (b > 0) {
      cout << "NO" << endl;
    } else {
      assert(w == 0);
      cout << "YES" << endl;
      for (auto it : res) cout << it.first << " " << it.second + need << endl;
    }
  }
  return 0;
}
