#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int MAXL = 250010;
int x[MAXN], y[MAXN];
int f[MAXL];
bool GetValue(int n, int* x, vector<int>& x1, vector<int>& x2) {
  int sumx = 0;
  for (int i = 0; i < n; ++i) sumx += x[i];
  if (sumx & 1) return false;
  sort(x, x + n);
  memset(f, -1, sizeof(f));
  f[0] = 0;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += x[i];
    if (sum > sumx / 2) sum = sumx / 2;
    for (int j = sum; j >= x[i]; --j) {
      if (f[j] != -1) continue;
      if (f[j - x[i]] != -1) f[j] = i;
    }
  }
  if (f[sum] == -1) {
    return false;
  }
  while (sum > 0) {
    x1.push_back(f[sum]);
    sum -= x[f[sum]];
  }
  sort(x1.begin(), x1.end());
  int k = 0;
  for (int i = 0; i < n; ++i) {
    if (k < x1.size() && x1[k] == i) {
      ++k;
      continue;
    }
    x2.push_back(i);
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int times;
  cin >> times;
  while (times--) {
    int n, m;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> x[i];
    cin >> m;
    for (int i = 0; i < m; ++i) cin >> y[i];
    if (n != m) {
      cout << "No" << endl;
      continue;
    }
    vector<int> x1, x2, y1, y2;
    if (!GetValue(n, x, x1, x2) || !GetValue(m, y, y1, y2)) {
      cout << "No" << endl;
      continue;
    }
    if (x1.size() > x2.size()) swap(x1, x2);
    if (y1.size() < y2.size()) swap(y1, y2);
    reverse(x1.begin(), x1.end());
    reverse(y2.begin(), y2.end());
    vector<pair<int, int>> ansx, ansy;
    int tx = 0, ty = 0;
    for (int i = 0; i < x1.size(); ++i) {
      tx += x[x1[i]];
      ansx.push_back(make_pair(tx, ty));
      ty += y[y1[i]];
      ansx.push_back(make_pair(tx, ty));
    }
    tx = 0, ty = 0;
    for (int i = 0; i < y2.size(); ++i) {
      ty += y[y2[i]];
      ansy.push_back(make_pair(tx, ty));
      tx += x[x2[i]];
      ansy.push_back(make_pair(tx, ty));
    }
    int base = y1.size() - x1.size();
    for (int i = 0; i < base; ++i) {
      ty -= y[y1[i + x1.size()]];
      ansy.push_back(make_pair(tx, ty));
      tx += x[x2[i + y2.size()]];
      ansy.push_back(make_pair(tx, ty));
    }
    cout << "Yes" << endl;
    for (auto& [a, b] : ansx) cout << a << " " << b << endl;
    for (int i = (int)ansy.size() - 2; i >= 0; --i) {
      cout << ansy[i].first << " " << ansy[i].second << endl;
    }
    cout << "0 0" << endl;
  }
  return 0;
}
