#include <bits/stdc++.h>
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& v) {
  return os << "(" << v.first << " " << v.second << ")";
}
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& v) {
  os << "[ ";
  for (auto& i : v) os << i << " ";
  return os << "]";
}
template <typename T>
void eout(const char* s, T H) {
  std::cerr << s << "=" << H << "\n";
}
template <typename T1, typename... T2>
void eout(const char* s, T1 H, T2... T) {
  while (*s != ',') std::cerr << *s++;
  std::cerr << "=" << H << " | ";
  eout(++s, T...);
}
using ll = long long int;
using vi = std::vector<int>;
using vb = std::vector<bool>;
using ii = std::pair<int, int>;
using iii = std::pair<ii, int>;
using vii = std::vector<ii>;
const int N = 505050;
const int MD = 1e9 + 7;
int solve();
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  int t;
  std::cin >> (t);
  for (int tc = (1); tc < (t + 1); ++tc) solve();
  return 0;
}
int solve() {
  int b;
  std::cin >> (b);
  int w;
  std::cin >> (w);
  int n = w + b;
  vii ans(n);
  int l = 0;
  int j = 3;
  if (b > w) std::swap(b, w), --j;
  for (int i = 0; i < (b); ++i) {
    ans[l++] = {(i + 1) << 1, j};
  }
  for (int i = 0; i < (std::min(b + 1, w)); ++i) {
    ans[l++] = {i << 1 | 1, j};
  }
  w -= std::min(b + 1, w);
  for (int i = 0; w and i < b; ++i, --w) {
    ans[l++] = {(i + 1) << 1, j - 1};
  }
  for (int i = 0; w and i < b; ++i, --w) {
    ans[l++] = {(i + 1) << 1, j + 1};
  }
  if (l == n) {
    std::cout << "YES\n";
    for (auto& i : ans) {
      std::cout << (i.first) << " ", std::cout << (i.second) << " ",
          std::cout << "\n";
    }
  } else {
    std::cout << "NO\n";
  }
  return 0;
}
