#include <bits/stdc++.h>
using namespace std;
int a[1001], b[1001], d[2][2][1001], D[2][1001], T, n, m, i, j, k, l, t[2][2],
    I, s1, s2, x, y, t2[2];
bitset<1000001> f[1001];
bool bz, Bz;
void work(int *a, int I, int s) {
  int i, j, k, l;
  for (i = 1; i <= n; i++) f[i] = f[i - 1] | (f[i - 1] << a[i]);
  if (f[n][s]) {
    for (i = n; i >= 1; i--)
      if (s >= a[i] && f[i - 1][s - a[i]])
        s -= a[i], d[I][0][++t[I][0]] = a[i];
      else
        d[I][1][++t[I][1]] = a[i];
  } else
    bz = 1;
}
void Write() {
  if (Bz)
    printf("%d %d\n", y, x);
  else
    printf("%d %d\n", x, y);
}
int main() {
  scanf("%d", &T), f[0][0] = 1;
  for (; T; --T) {
    s1 = s2 = bz = Bz = t[0][0] = t[0][1] = t[1][0] = t[1][1] = 0;
    scanf("%d", &n);
    for (i = 1; i <= n; i++) scanf("%d", &a[i]), s1 += a[i];
    scanf("%d", &m);
    for (i = 1; i <= m; i++) scanf("%d", &b[i]), s2 += b[i];
    sort(a + 1, a + n + 1), sort(b + 1, b + n + 1);
    if ((s1 & 1) || (s2 & 1) || n != m) {
      printf("No\n");
      continue;
    }
    s1 >>= 1, s2 >>= 1;
    work(a, 0, s1);
    work(b, 1, s2);
    if (bz) {
      printf("No\n");
      continue;
    }
    printf("Yes\n");
    I = Bz = t[0][0] > t[1][0];
    x = y = t2[0] = t2[1] = 0;
    for (i = 1; i <= t[I][0]; i++) D[0][++t2[0]] = d[I][0][i];
    for (i = 1; i <= t[I][1]; i++) D[0][++t2[0]] = -d[I][1][i];
    for (i = t[I ^ 1][0]; i >= 1; i--) D[1][++t2[1]] = d[I ^ 1][0][i];
    for (i = t[I ^ 1][1]; i >= 1; i--) D[1][++t2[1]] = -d[I ^ 1][1][i];
    for (i = 1; i <= n; i++) {
      x += D[0][i], Write();
      y += D[1][i], Write();
    }
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
