#include <bits/stdc++.h>
using namespace std;
pair<int, int> mp(int i, int j) {
  pair<int, int> ret;
  ret.first = i, ret.second = j;
  return ret;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int b, w;
    scanf("%d%d", &b, &w);
    int x = 3, y = 2;
    vector<pair<int, int> > ans;
    if (b > w) x = 2, swap(w, b);
    if (w > b * 3 + 1) {
      printf("NO\n");
      continue;
    }
    printf("YES\n");
    ans.push_back(mp(x - 1, y));
    for (int i = 0; i < b; i++) {
      ans.push_back(mp(x, y + 1));
      ans.push_back(mp(x, y - 1));
      printf("%d %d\n", x, y);
      x++;
      printf("%d %d\n", x, y);
      x++;
      w--;
    }
    while (w--) printf("%d %d\n", ans[w].first, ans[w].second);
  }
}
