#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
long long test = 1;
cin >> test;
bool submit = true;
if (test >= 10010010)
submit = false;
if (test == 1)
submit = true;
while (test--) {
int X, Y;
cin >> X >> Y;
if (X > Y) {
cout << "NO\n";
continue;
}
int N = X + Y;
if (N % 2 == 0 && X == 0) {
cout << "NO\n";
continue;
}
int pos = 0;
vector<pair<int, int>> answer;
if (N % 2 == 0)
X--;
else
Y--;
N--;
while (X) {
answer.push_back({pos, pos + 1}), pos++;
if (N % 2 == 0)
X--;
else
Y--;
N--;
}
int pos2 = pos;
while (Y--)
answer.push_back({pos, ++pos2});
cout << "YES\n";
for (auto [u, v] : answer)
cout << u + 1 << " " << v + 1 << "\n";
}
}