#include <bits/stdc++.h>
using namespace std;
vector<int> solveProblem(bool order) {
  int h, sum = 0, targetWeight;
  int l[1010];
  cin >> h;
  for (int i = 0; i < h; i++) {
    cin >> l[i];
    sum += l[i];
  }
  if (sum % 2 == 1) return {};
  targetWeight = sum / 2;
  vector<bitset<1010 * 1010>> package(h + 1);
  package[0].set(0);
  for (int i = 0; i < h; i++) {
    package[i + 1] = package[i] | (package[i] << l[i]);
  }
  if (!package[h].test(targetWeight)) return {};
  vector<int> x, y;
  for (int i = h - 1; i >= 0; i--) {
    if (package[i].test(targetWeight))
      y.emplace_back(l[i]);
    else {
      targetWeight -= l[i];
      x.emplace_back(l[i]);
    }
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  if (order) {
    reverse(x.begin(), x.end());
    reverse(y.begin(), y.end());
  }
  if (x.size() < y.size()) swap(x, y);
  if (order) swap(x, y);
  for (int i = 0; i < y.size(); i++) y[i] = -y[i];
  x.insert(x.end(), y.begin(), y.end());
  return x;
}
int work() {
  auto a = solveProblem(true);
  auto b = solveProblem(false);
  if (a.size() != b.size() || a.size() == 0) {
    cout << "No" << endl;
    return 0;
  }
  int x = 0, y = 0;
  cout << "Yes" << endl;
  auto ita = a.begin();
  auto itb = b.begin();
  while (itb != b.end()) {
    x += *(ita++);
    cout << x << " " << y << endl;
    y += *(itb++);
    cout << x << " " << y << endl;
  }
  return 0;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    work();
  }
  return 0;
}
