#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int cases;
  cin >> cases;
  while (cases--) {
    int b, w;
    cin >> b >> w;
    map<pair<int, int>, int> mp;
    auto valid = [&](int x, int y) {
      if (mp.find({x, y}) != mp.end()) return false;
      return (x > 0 and x <= 1e9 and y > 0 and y <= 1e9);
    };
    vector<pair<int, int> > res(b + w);
    int j = 0;
    int dx[] = {0, -1, 0, 1};
    int dy[] = {-1, 0, 1, 0};
    function<void(int, int)> dfs = [&](int x, int y) {
      if (b <= 0 and w <= 0) return;
      res[j++] = {x, y};
      if ((x + y) % 2 == 0)
        w--;
      else
        b--;
      mp[{x, y}] = 1;
      for (int i = 0; i < 4; i++) {
        int xx = x + dx[i];
        int yy = y + dy[i];
        if (!valid(xx, yy)) continue;
        if ((xx + yy) % 2 == 1 and b > 0) {
          dfs(xx, yy);
        } else if ((xx + yy) % 2 == 0 and w > 0) {
          dfs(xx, yy);
        }
      }
    };
    dfs(1e6, 1e6);
    if (b > 0 or w > 0) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
    for (auto& r : res) {
      cout << r.first << " " << r.second << "\n";
    }
  }
}
