#include <bits/stdc++.h>
template <class T>
inline void rd(T &x) {
  char c = getchar(), f = 0;
  x = 0;
  while (!isdigit(c)) f = (c == '-'), c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x = f ? -x : x;
}
const int MAXN = 1000 + 7;
int n, m, a[MAXN], b[MAXN], d[2][MAXN];
std::bitset<1000007> f[1001];
bool bel1[MAXN], bel2[MAXN];
bool work(int n, int s, int a[], bool bel[]) {
  for (int i = (1); i <= (n); ++i)
    f[i] = f[i - 1] | (f[i - 1] << a[i]), bel[i] = 0;
  if (!f[n].test(s)) return 0;
  int now = s;
  for (int i = (n); i >= (1); --i) {
    if (now >= a[i]) {
      if (f[i - 1].test(now - a[i])) now -= a[i], bel[i] = 1;
    }
  }
  return 1;
}
void solve() {
  int s1 = 0, s2 = 0;
  rd(n);
  for (int i = (1); i <= (n); ++i) rd(a[i]), s1 += a[i];
  rd(m);
  for (int i = (1); i <= (m); ++i) rd(b[i]), s2 += b[i];
  if ((s1 & 1) || (s2 & 1) || n != m) {
    puts("No");
    return;
  }
  std::sort(a + 1, a + n + 1);
  std::sort(b + 1, b + m + 1);
  std::reverse(a + 1, a + n + 1);
  std::reverse(b + 1, b + m + 1);
  if (work(n, s1 / 2, a, bel1) && work(m, s2 / 2, b, bel2)) {
    puts("Yes");
    std::vector<int> x, xx, y, yy;
    for (int i = (1); i <= (n); ++i)
      if (bel1[i])
        x.push_back(a[i]);
      else
        xx.push_back(a[i]);
    for (int i = (1); i <= (m); ++i)
      if (bel2[i])
        y.push_back(b[i]);
      else
        yy.push_back(b[i]);
    bool tag = 0;
    if (x.size() > y.size()) tag = 1;
    if (tag) std::swap(x, y), std::swap(xx, yy);
    std::reverse((y).begin(), (y).end());
    std::reverse((yy).begin(), (yy).end());
    int ptr = 0;
    for (auto v : x) d[0][++ptr] = v;
    for (auto v : xx) d[0][++ptr] = -v;
    ptr = 0;
    for (auto v : y) d[1][++ptr] = v;
    for (auto v : yy) d[1][++ptr] = -v;
    int dx = 0, dy = 0;
    for (int i = (1); i <= (n); ++i) {
      dx += d[0][i];
      if (tag)
        printf("%d %d\n", dy, dx);
      else
        printf("%d %d\n", dx, dy);
      dy += d[1][i];
      if (tag)
        printf("%d %d\n", dy, dx);
      else
        printf("%d %d\n", dx, dy);
    }
  } else
    puts("No");
}
int main() {
  f[0][0] = 1;
  int T;
  rd(T);
  while (T--) solve();
  return 0;
}
