#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n, long long lelo) {
  if (n == 0) return 1;
  if (n == 1) return a;
  if (n == 2) return (a * a) % lelo;
  if (n % 2)
    return (a * power(a, n - 1, lelo)) % lelo;
  else
    return power(power(a, n / 2, lelo), 2, lelo) % lelo;
}
void swap(long long &a, long long &b) {
  auto tm = a;
  a = b;
  b = tm;
}
const long long N = 1e5 + 5;
const long long INF = 1e18;
long long b, w;
map<pair<long long, long long>, long long> m;
vector<pair<long long, long long> > ans;
void doit(long long x, long long y) {
  if (x < 1 || y < 1 || x > 1e9 || y > 1e9) return;
  if (m[{x, y}]) return;
  m[{x, y}] = 1;
  if ((x + y) % 2) {
    if (b > 0) {
      b--;
      ans.push_back({x, y});
    } else
      return;
  } else {
    if (w > 0) {
      w--;
      ans.push_back({x, y});
    } else
      return;
  }
  doit(x - 1, y);
  doit(x + 1, y);
  doit(x, y - 1);
  doit(x, y + 1);
}
void solve() {
  ans.clear();
  m.clear();
  cin >> b >> w;
  doit(1e6, 1e6);
  if (b != 0 || w != 0) {
    cout << "NO";
    return;
  }
  cout << "YES"
       << "\n";
  for (auto &(i) : (ans)) cout << i.first << " " << i.second << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long double tt = 1.0 * clock();
  long long t = 1;
  cin >> t;
  for (long long(i) = (1); (i) < (t + 1); (i)++) {
    solve();
    if (i < t) cout << "\n";
  }
  tt = 1.000000000 * (clock() - tt) / CLOCKS_PER_SEC;
  return 0;
}
