#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long q, a, b;
  cin >> q;
  for (long long i = 0; i < q; ++i) {
    cin >> a >> b;
    if ((min(a, b) - 1) * 3 + 4 < max(a, b))
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      long long col;
      pair<long long, long long> start;
      if (a > b) {
        start = make_pair(2, 2);
        col = 0;
      } else {
        start = make_pair(2, 3);
        col = 1;
      }
      while (min(a, b) > 0) {
        cout << start.first << ' ' << start.second << endl;
        if (col) {
          a--;
          col = !col;
        } else {
          b--;
          col = !col;
        }
        start.first += 1;
      }
      if (a == 0) {
        long long x = 2, y = 3;
        if (b != 0) cout << 1 << ' ' << 3 << endl, b--;
        while (b >= 2 && x < start.first) {
          cout << x << ' ' << y + 1 << endl;
          cout << x << ' ' << y - 1 << endl;
          x += 2;
          b -= 2;
        }
        if (b > 0) cout << start.first << ' ' << start.second << endl;
      } else {
        long long x = 2, y = 2;
        if (a != 0) cout << 1 << ' ' << 2 << endl, a--;
        while (a >= 2 && x < start.first) {
          cout << x << ' ' << y + 1 << endl;
          cout << x << ' ' << y - 1 << endl;
          x += 2;
          a -= 2;
        }
        if (a > 0) cout << start.first << ' ' << start.second << endl;
      }
    }
  }
  return 0;
}
