#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int maxa = 1000005;
int n, m, a[maxn], b[maxn], x[maxn], y[maxn], suma, sumb, sza, szb;
bool A[maxn], B[maxn];
bitset<maxa> f[maxn];
inline void solve() {
  suma = sumb = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), suma += a[i];
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]), sumb += b[i];
  sort(a + 1, a + n + 1), sort(b + 1, b + m + 1);
  if (n != m || suma & 1 || sumb & 1) {
    puts("No");
    return;
  }
  f[0].reset(), f[0][0] = 1;
  for (int i = 1; i <= n; i++) f[i] = f[i - 1] | (f[i - 1] << a[i]);
  if (f[n][suma / 2] == 0) {
    puts("No");
    return;
  }
  for (int i = n, val = suma / 2; i; i--)
    if (val >= a[i] && f[i - 1][val - a[i]])
      A[i] = 0, val -= a[i];
    else
      A[i] = 1;
  f[0].reset(0), f[0][0] = 1;
  for (int i = 1; i <= m; i++) f[i] = f[i - 1] | (f[i - 1] << b[i]);
  if (f[m][sumb / 2] == 0) {
    puts("No");
    return;
  }
  for (int i = m, val = sumb / 2; i; i--)
    if (val >= b[i] && f[i - 1][val - b[i]])
      B[i] = 0, val -= b[i];
    else
      B[i] = 1;
  for (int i = 1; i <= n + m; i++) x[i] = y[i] = 0;
  x[0] = y[0] = sza = szb = 0;
  for (int i = n; i; i--)
    if (!A[i]) x[sza << 1 | 1] = -a[i], sza++;
  for (int i = 1; i <= n; i++)
    if (A[i]) x[sza << 1 | 1] = a[i], sza++;
  for (int i = m; i; i--)
    if (B[i]) szb++, y[szb << 1] = b[i];
  for (int i = 1; i <= m; i++)
    if (!B[i]) szb++, y[szb << 1] = -b[i];
  puts("Yes");
  for (int i = 1; i <= n + m; i++)
    x[i] += x[i - 1], y[i] += y[i - 1], printf("%d %d\n", x[i], y[i]);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
