#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int b, w;
    cin >> b >> w;
    set<pair<int, int> > ans;
    if (b <= w) {
      if (w > 3 * b + 1) {
        cout << "NO" << endl;
        continue;
      }
      for (int i = 3; i < 2 * b + 2; i++) ans.insert({i, 2});
      int left = w - b + 1;
      if (left) {
        ans.insert({2, 2});
        left--;
      }
      if (left) {
        ans.insert({2 * b + 2, 2});
        left--;
      }
      if (left) {
        for (int i = 3; i < 2 * b + 2; i += 2) {
          if (left == 0) break;
          ans.insert({i, 1});
          left--;
          if (left == 0) break;
          ans.insert({i, 3});
          left--;
        }
      }
    } else {
      if (b > 3 * w + 1) {
        cout << "NO" << endl;
        continue;
      }
      for (int i = 2; i < 2 * w + 1; i++) ans.insert({i, 2});
      int left = b - w + 1;
      if (left) {
        ans.insert({1, 2});
        left--;
      }
      if (left) {
        ans.insert({2 * w + 1, 2});
        left--;
      }
      if (left) {
        for (int i = 2; i < 2 * w + 1; i += 2) {
          if (left == 0) break;
          ans.insert({i, 1});
          left--;
          if (left == 0) break;
          ans.insert({i, 3});
          left--;
        }
      }
    }
    cout << "YES" << endl;
    for (auto x : ans) cout << x.first << " " << x.second << endl;
  }
  return 0;
}
