#include <bits/stdc++.h>
using namespace std;
long long flag = 0;
void go(long long i, long long j) { printf("%lld %lld\n", i + flag, j); }
void solve() {
  flag = 0;
  long long b, w;
  scanf("%lld %lld", &b, &w);
  if (w > b) {
    swap(w, b);
    flag = 1;
  }
  if (3 * w + 1 < b) {
    cout << "NO\n";
    return;
  }
  cout << "YES\n";
  for (long long i = 1; i <= w; i++) go(2 * i, 4);
  for (long long i = 1; i <= w; i++) go(2 * i + 1, 4);
  long long rem = b - w;
  if (rem == 0) return;
  go(1, 4);
  rem--;
  if (rem == 0) return;
  for (long long i = 1; i <= w; i++) {
    if (rem > 0) {
      rem--;
      go(2 * i, 3);
    } else
      return;
  }
  for (long long i = 1; i <= w; i++) {
    if (rem > 0) {
      rem--;
      go(2 * i, 5);
    } else
      return;
  }
}
signed main() {
  long long t = 1;
  scanf("%lld", &t);
  while (t--) solve();
}
