#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
int z[][2] = {{-1, 0}, {1, 0}};
vector<ii> solve(int x, int y) {
  if (x < y) swap(x, y);
  vector<ii> a;
  x -= y - 1;
  for (int k = 0; k < 2 * y - 1; ++k) {
    a.push_back({2, 3 + k});
    if (~k & 1)
      for (int j = 0; j < 2 && x > 0; ++j, --x)
        a.push_back({2 + z[j][0], 3 + k + z[j][1]});
  }
  if (x-- > 0) a.push_back({2, 2});
  if (x > 0) a.push_back({2, 4 + 2 * (y - 1)});
  return a;
}
signed main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int b, w;
    cin >> b >> w;
    if (max(w, b) > 3 * min(w, b) + 1) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
    auto a = solve(w, b);
    if (b > w)
      for (auto& [x, y] : a) --y;
    for (auto [x, y] : a) cout << x << ' ' << y << '\n';
  }
  return 0;
}
