#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int b, w, i, minn, maxx, toggle = 0;
    cin >> b >> w;
    minn = min(b, w);
    maxx = max(b, w);
    if (minn * 3 + 1 < maxx)
      cout << "NO"
           << "\n";
    else {
      cout << "YES"
           << "\n";
      toggle = (b < w ? 1 : 0);
      vector<pair<long long int, long long int>> ans;
      for (i = 0; i < 2 * minn; i++) ans.push_back(make_pair(2, 2 + i));
      maxx -= minn;
      for (i = 0; i < 2 * minn; i += 2) {
        if (maxx == 0)
          break;
        else {
          ans.push_back(make_pair(1, 2 + i));
          maxx--;
        }
        if (maxx == 0)
          break;
        else {
          ans.push_back(make_pair(3, 2 + i));
          maxx--;
        }
      }
      if (maxx != 0) ans.push_back(make_pair(2, 1));
      if (toggle) {
        for (i = 0; i < b + w; i++) ans[i].second++;
      }
      for (i = 0; i < b + w; i++)
        cout << ans[i].first << " " << ans[i].second << "\n";
    }
  }
}
