#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  int b, w, k = 0, minn, maxx, m, y;
  for (int i = 0; i < t; i++) {
    scanf("%d%d", &b, &w);
    if (w > 3 * b + 1 || b > 3 * w + 1) {
      printf("NO\n");
      continue;
    } else {
      printf("YES\n");
      if (b == w) {
        k = 1;
        while (b != 0) {
          printf("%d %d\n", 1, k);
          printf("%d %d\n", 1, k + 1);
          k += 2;
          b -= 1;
        }
      } else if (b + 1 == w) {
        k = 1;
        while (b != 0) {
          printf("%d %d\n", 1, k);
          printf("%d %d\n", 1, k + 1);
          k += 2;
          b -= 1;
        }
        printf("1 %d\n", k);
      } else if (w + 1 == b) {
        k = 2;
        while (w != 0) {
          printf("%d %d\n", 1, k);
          printf("%d %d\n", 1, k + 1);
          k += 2;
          w -= 1;
        }
        printf("1 %d\n", k);
      } else {
        minn = min(b, w);
        maxx = max(b, w);
        k = 2;
        if (minn == b) {
          m = 3;
        } else {
          m = 4;
        }
        while (minn != 0) {
          printf("%d %d\n", m, k);
          printf("%d %d\n", m, k + 1);
          k += 2;
          maxx -= 1;
          minn -= 1;
        }
        y = 2;
        while (maxx != 0 && y <= k - 2) {
          printf("%d %d\n", m - 1, y);
          maxx -= 1;
          if (maxx > 0) {
            printf("%d %d\n", m + 1, y);
            maxx -= 1;
          }
          y += 2;
        }
        if (maxx > 0) {
          printf("%d %d\n", m, 1);
          maxx -= 1;
        }
        if (maxx > 0) {
          printf("%d %d\n", m, k - 1);
        }
      }
    }
  }
}
