#include <bits/stdc++.h>
long long int gcd(unsigned long long int a, unsigned long long int b) {
  return (a == 0) ? b : gcd(b % a, a);
}
long long int lcm(unsigned long long int a, unsigned long long int b) {
  return a * (b / gcd(a, b));
}
int trinum(int x) { return x * (x + 1) / 2; }
int kx[8] = {+2, +2, -2, -2, +1, +1, -1, -1};
int ky[8] = {+1, -1, +1, -1, +2, -2, +2, -2};
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int b, w;
    bool p = 0;
    cin >> b >> w;
    vector<pair<int, int> > wells, bells;
    if (w >= b) {
      swap(b, w);
      p = 1;
    }
    if (b > (3 * w + 1)) {
      cout << "NO\n";
    } else {
      for (int i = 0; i < w; i++) {
        wells.push_back({0, i * 2});
        bells.push_back({0, (i * 2) + 1});
        b--;
      }
      if (b != 0) {
        bells.push_back({0, -1});
        b--;
        if (b != 0) {
          for (int i = 0; i < w && b > 0; i++) {
            bells.push_back({-1, i * 2});
            b--;
          }
          if (b != 0) {
            for (int i = 0; i < w && b > 0; i++) {
              bells.push_back({1, i * 2});
              b--;
            }
            if (b != 0) {
              cout << "NO\n";
              continue;
            }
          }
        }
      }
      cout << "YES\n";
      if (p) {
        for (int i = 0; i < bells.size(); i++) {
          cout << bells[i].first + 3 << ' ' << bells[i].second + 2 << endl;
        }
        for (int i = 0; i < wells.size(); i++) {
          cout << wells[i].first + 3 << ' ' << wells[i].second + 2 << endl;
        }
      } else {
        for (int i = 0; i < bells.size(); i++) {
          cout << bells[i].first + 2 << ' ' << bells[i].second + 2 << endl;
        }
        for (int i = 0; i < wells.size(); i++) {
          cout << wells[i].first + 2 << ' ' << wells[i].second + 2 << endl;
        }
      }
    }
    cout << endl;
  }
}
