#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unrolled-loops")
using namespace std;
const long long mod = 998244353;
const long long INF = 1e16;
long long test = 1;
void Varvalian() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long q;
long long b, w;
vector<pair<long long, long long> > bb, ww;
int32_t main() {
  Varvalian();
  cin >> q;
  while (q--) {
    cin >> b >> w;
    bb.clear();
    ww.clear();
    long long sx, sy;
    long long cntb, cntw;
    if (b < w) {
      long long bx, by, wx, wy;
      if (3 * b + 1 < w) {
        cout << "NO" << '\n';
        continue;
      } else {
        cout << "YES" << '\n';
        cntb = 0, cntw = 0;
        bx = 2;
        by = 3;
        while (cntb < b) {
          bb.push_back(make_pair(bx, by));
          ww.push_back(make_pair(bx + 1, by));
          bx += 2;
          cntb++;
          cntw++;
        }
        wx = 2;
        wy = 2;
        if (cntw < w)
          for (long long i = 0; i < b; i++) {
            ww.push_back(make_pair(wx + 2 * i, wy));
            cntw++;
            if (cntw == w) break;
          }
        wx = 2;
        wy = 4;
        if (cntw < w)
          for (long long i = 0; i < b; i++) {
            ww.push_back(make_pair(wx + 2 * i, wy));
            cntw++;
            if (cntw == w) break;
          }
        if (cntw < w) ww.push_back(make_pair(1, 3));
        for (long long i = 0; i < bb.size(); i++)
          cout << bb[i].first << " " << bb[i].second << '\n';
        for (long long i = 0; i < ww.size(); i++)
          cout << ww[i].first << " " << ww[i].second << '\n';
      }
    } else {
      long long bx, by, wx, wy;
      if (3 * w + 1 < b) {
        cout << "NO" << '\n';
        continue;
      } else {
        cout << "YES" << '\n';
        cntb = 0, cntw = 0;
        wx = 3;
        wy = 3;
        while (cntw < w) {
          ww.push_back(make_pair(wx, wy));
          bb.push_back(make_pair(wx + 1, wy));
          wx += 2;
          cntb++;
          cntw++;
        }
        bx = 3;
        by = 2;
        if (cntb < b)
          for (long long i = 0; i < w; i++) {
            bb.push_back(make_pair(bx + 2 * i, by));
            cntb++;
            if (cntb == b) break;
          }
        bx = 3;
        by = 4;
        if (cntb < b)
          for (long long i = 0; i < w; i++) {
            bb.push_back(make_pair(bx + 2 * i, by));
            cntb++;
            if (cntb == b) break;
          }
        if (cntb < b) bb.push_back(make_pair(2, 3));
        for (long long i = 0; i < bb.size(); i++)
          cout << bb[i].first << " " << bb[i].second << '\n';
        for (long long i = 0; i < ww.size(); i++)
          cout << ww[i].first << " " << ww[i].second << '\n';
      }
    }
  }
}
