#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char ch) {
  ch = tolower(ch);
  return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ||
          ch == 'y');
}
inline bool isprime(int n) {
  if (n < 2 || (n % 2 == 0 && n != 2)) return false;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t;
  cin >> t;
  while (t--) {
    int b, w, x = 2, y = 3, addb, addw;
    int flag = 0;
    cin >> b >> w;
    if ((w < b - 1 && b > w * 3 + 1) || (b < w - 1 && w > b * 3 + 1)) {
      cout << "NO\n";
      continue;
    }
    if (b > w) {
      swap(b, w);
      flag++;
    }
    addb = b;
    addw = w;
    vector<pair<int, int> > white, black;
    while (addb) {
      black.push_back(make_pair(x, y));
      addb--;
      x += 2;
    }
    x -= 2;
    while (x != 2) {
      white.push_back(make_pair(x - 1, y));
      addw--;
      x -= 2;
    }
    for (auto to : black) {
      if (addw) {
        white.push_back(make_pair(to.first, to.second - 1));
        addw--;
      }
      if (addw) {
        white.push_back(make_pair(to.first, to.second + 1));
        addw--;
      }
    }
    if (addw) {
      white.push_back(make_pair(1, 3));
      addw--;
    }
    if (addw) {
      white.push_back(make_pair(black.back().first + 1, 3));
      addw--;
    }
    for (auto &to : black)
      if (flag) to.second++;
    for (auto &to : white)
      if (flag) to.second++;
    cout << "YES\n";
    for (auto to : black) cout << to.first << ' ' << to.second << endl;
    for (auto to : white) cout << to.first << ' ' << to.second << endl;
  }
  return 0;
}
