#include <bits/stdc++.h>
using namespace std;
const int INT_INF = 1e9;
const long long LL_INF = 1e18;
const int MAXN = 500003;
typedef struct GE {
  int to;
  long long w;
} GE;
typedef struct V {
  int x, y, c;
} V;
int n, m;
int A[MAXN];
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
vector<pair<int, int> > solve(pair<int, int> start, int c1, int c2) {
  vector<pair<int, int> > ans;
  for (int i = 0; i < 2 * c1; i++)
    ans.push_back(pair<int, int>(start.first, start.second + i));
  c2 -= c1;
  for (int i = 0; i < c2 && i < c1; i++) {
    ans.push_back(pair<int, int>(start.first + 1, start.second + 2 * i));
  }
  c2 -= c1;
  for (int i = 0; i < c2 && i < c1; i++) {
    ans.push_back(pair<int, int>(start.first - 1, start.second + 2 * i));
  }
  c2 -= c1;
  if (c2 == 1) ans.push_back(pair<int, int>(start.first, start.second - 1));
  return ans;
}
int main() {
  int Q;
  scanf("%d", &Q);
  while (Q--) {
    int b, w;
    scanf("%d %d", &b, &w);
    if (b > 3 * w + 1 || w > 3 * b + 1) {
      puts("NO");
      continue;
    }
    puts("YES");
    vector<pair<int, int> > ans;
    if (b > w)
      ans = solve(pair<int, int>(10, 10), w, b);
    else
      ans = solve(pair<int, int>(10, 11), b, w);
    for (auto ai : ans) printf("%d %d\n", ai.first, ai.second);
  }
  return 0;
}
