#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned int t, n, m;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> m;
    if ((n >= m && n <= 3 * m + 1) || (m >= n && m <= 3 * n + 1)) {
      cout << "YES\n";
      if (n < m) {
        for (int i = 1; i <= n; i++) cout << 3 << ' ' << 2 * i << '\n';
        for (int i = 1; i < n; i++) cout << 3 << ' ' << 2 * i + 1 << '\n';
        if (n) m -= (n - 1);
        for (int i = 1; i <= n && i <= m; i++)
          cout << 2 << ' ' << 2 * i << '\n';
        if (m > n)
          m -= n;
        else
          m = 0;
        for (int i = 1; i <= n && i <= m; i++)
          cout << 4 << ' ' << 2 * i << '\n';
        if (m > n)
          m -= n;
        else
          m = 0;
        if (m) cout << 3 << ' ' << 1 << '\n';
        if (m) m--;
        if (m) cout << 3 << ' ' << 2 * n + 1 << '\n';
      } else {
        for (int i = 1; i <= m; i++) cout << 4 << ' ' << 2 * i << '\n';
        for (int i = 1; i < m; i++) cout << 4 << ' ' << 2 * i + 1 << '\n';
        if (m) n -= (m - 1);
        for (int i = 1; i <= m && i <= n; i++)
          cout << 3 << ' ' << 2 * i << '\n';
        if (n > m)
          n -= m;
        else
          n = 0;
        for (int i = 1; i <= n && i <= m; i++)
          cout << 5 << ' ' << 2 * i << '\n';
        if (n > m)
          n -= m;
        else
          n = 0;
        if (n) cout << 4 << ' ' << 1 << '\n';
        if (n) n--;
        if (n) cout << 4 << ' ' << 2 * m + 1 << '\n';
      }
    } else
      cout << "NO\n";
  }
  return 0;
}
