#include <bits/stdc++.h>
using namespace std;
int main() {
  int T, b, w, tmp;
  scanf("%d", &T);
  while (T--) {
    scanf("%d %d", &b, &w);
    if (b >= w)
      tmp = 2;
    else
      tmp = 3, swap(b, w);
    if (b > 3 * w + 1)
      printf("NO\n");
    else {
      printf("YES\n");
      for (int i = 1; i <= w; ++i) {
        printf("%d\t%d\n", tmp, 2 * i);
        printf("%d\t%d\n", tmp, 2 * i - 1);
      }
      b -= w;
      if (b) printf("%d\t%d\n", tmp, 2 * w + 1), b--;
      int i = 1;
      while (b) {
        printf("%d\t%d\n", tmp - 1, 2 * i);
        b--;
        if (b) printf("%d\t%d\n", tmp + 1, 2 * i), b--;
        i++;
      }
    }
  }
}
