#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
const long long inf = 1e18 + 10;
int n, m;
int nex[4][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
void slove() {
  int b, w;
  cin >> w >> b;
  if (b > w * 3 + 1 || w > b * 3 + 1)
    puts("NO");
  else {
    puts("YES");
    if (b >= w) {
      if (b > w) puts("2 2"), b--;
      int x = 3, y = 2;
      while (w--) {
        cout << x << " " << y << endl;
        for (int i = 1; i < 4; i++) {
          if (b <= w) break;
          b--;
          int tx = x + nex[i][0], ty = y + nex[i][1];
          cout << tx << " " << ty << endl;
        }
        x += 2;
      }
    } else {
      puts("1 2"), w--;
      int x = 2, y = 2;
      while (b--) {
        cout << x << " " << y << endl;
        for (int i = 1; i < 4; i++) {
          if (b >= w) break;
          int tx = x + nex[i][0], ty = y + nex[i][1];
          cout << tx << " " << ty << endl;
          w--;
        }
        x += 2;
      }
    }
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    slove();
  }
}
