#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    int black, white;
    cin >> black >> white;
    pair<int, int> current = {2, 3};
    if (black > white) {
      current = {2, 2};
      swap(black, white);
    }
    if (white > black * 3 + 1) {
      cout << "NO" << '\n';
      continue;
    }
    vector<pair<int, int>> bl_ans, wh_ans;
    for (int i = 0; i < black; i++) {
      bl_ans.push_back(current);
      if (white > 0) {
        wh_ans.emplace_back(current.first, current.second + 1);
        white--;
      }
      current.second += 2;
    }
    for (int i = 0; i < bl_ans.size(); i++) {
      auto curr = bl_ans[i];
      if (white > 0) {
        wh_ans.emplace_back(curr.first - 1, curr.second);
        white--;
      }
      if (white > 0) {
        wh_ans.emplace_back(curr.first + 1, curr.second);
        white--;
      }
    }
    if (white) {
      wh_ans.emplace_back(bl_ans[0].first, bl_ans[0].second - 1);
      white--;
    }
    cout << "YES" << '\n';
    for (auto &i : bl_ans) cout << i.first << " " << i.second << '\n';
    for (auto &i : wh_ans) cout << i.first << " " << i.second << '\n';
  }
  return 0;
}
