#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int w, b;
    cin >> b >> w;
    vector<pair<int, int> > ret;
    if (w <= b) {
      int x = 1;
      while (w--) {
        ret.push_back(pair<int, int>(2, x));
        ret.push_back(pair<int, int>(2, x + 1));
        x += 2;
        b--;
      }
      if (b > 0) {
        ret.push_back(pair<int, int>(2, x));
        b--;
      }
      int u = 2;
      while (b) {
        if (u > x) break;
        ret.push_back(pair<int, int>(1, u));
        u += 2;
        b--;
      }
      u = 2;
      while (b) {
        if (u > x) break;
        ret.push_back(pair<int, int>(3, u));
        u += 2;
        b--;
      }
      if (b > 0) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
        for (int i = 0; i < ret.size(); i++) {
          cout << ret[i].first << " " << ret[i].second << endl;
        }
      }
    } else {
      int x = 1;
      while (b--) {
        ret.push_back(pair<int, int>(3, x));
        ret.push_back(pair<int, int>(3, x + 1));
        x += 2;
        w--;
      }
      if (w > 0) {
        ret.push_back(pair<int, int>(3, x));
        w--;
      }
      int u = 2;
      while (w) {
        if (u > x) break;
        ret.push_back(pair<int, int>(2, u));
        u += 2;
        w--;
      }
      u = 2;
      while (w) {
        if (u > x) break;
        ret.push_back(pair<int, int>(4, u));
        u += 2;
        w--;
      }
      if (w > 0) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
        for (int i = 0; i < ret.size(); i++) {
          cout << ret[i].first << " " << ret[i].second << endl;
        }
      }
    }
  }
}
