#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2e5 + 100;
int b, w;
void solve() {
  scanf("%d%d", &b, &w);
  int c = min(b, w), d = max(b, w);
  if (d > 3ll * c + 1ll) {
    printf("NO\n");
    return;
  }
  printf("YES\n");
  int sx, sy;
  if (w >= b) {
    sx = 3, sy = 2;
    for (int i = (1); i <= (b); ++i) {
      printf("%d %d\n%d %d\n", sx, sy, sx - 1, sy);
      sx += 2;
    }
    w -= b;
    sx -= 2;
    if (w) printf("%d %d\n", sx + 1, sy), w--;
    while (w) {
      if (w) printf("%d %d\n", sx, sy + 1), w--;
      if (w) printf("%d %d\n", sx, sy - 1), w--;
      sx -= 2;
    }
  } else {
    sx = 2, sy = 2;
    for (int i = (1); i <= (w); ++i) {
      printf("%d %d\n%d %d\n", sx, sy, sx - 1, sy);
      sx += 2;
    }
    b -= w;
    sx -= 2;
    if (b) printf("%d %d\n", sx + 1, sy), b--;
    while (b) {
      if (b) printf("%d %d\n", sx, sy + 1), b--;
      if (b) printf("%d %d\n", sx, sy - 1), b--;
      sx -= 2;
    }
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) solve();
}
