#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10, mod = 998244353;
struct sc {
  int x, y;
};
vector<sc> ans[2];
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int vis[10][N];
int main() {
  int q, b, w;
  scanf("%d", &q);
  while (q--) {
    memset(vis, 0, sizeof vis);
    ans[0].clear();
    ans[1].clear();
    scanf("%d %d", &b, &w);
    if (b * 3 + 1 < w || w * 3 + 1 < b) {
      puts("NO");
      continue;
    }
    for (int i = 0; i < min(b, w); i++) {
      ans[0].push_back({2, 2 + 2 * i});
      ans[1].push_back({2, 2 + 2 * i + 1});
      vis[2][2 + 2 * i + 1]++;
    }
    int m = ans[0].size();
    int i = 0;
    while (i < m) {
      if (ans[1].size() >= max(b, w)) break;
      int x = ans[0][i].x, y = ans[0][i].y;
      for (int k = 0; k < 4; k++) {
        if (!vis[x + dx[k]][y + dy[k]]) {
          vis[x + dx[k]][y + dy[k]] = 1;
          ans[1].push_back({x + dx[k], y + dy[k]});
          if (ans[1].size() >= max(b, w)) break;
        }
      }
      if (ans[1].size() >= max(b, w)) break;
      i++;
    }
    puts("YES");
    for (int i = 0; i < ans[0].size(); i++) {
      printf("%d %d\n", ans[0][i].x + (b < w), ans[0][i].y);
    }
    for (int i = 0; i < ans[1].size(); i++) {
      printf("%d %d\n", ans[1][i].x + (b < w), ans[1][i].y);
    }
  }
}
