#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
inline int add(int a, int b) { return (a += b) >= mod ? a - mod : a; }
inline int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
inline int mul(int a, int b) { return (long long)a * b % mod; }
inline int qpow(int a, int b) {
  int res = 1;
  for (; b; a = mul(a, a), b >>= 1)
    if (b & 1) res = mul(res, a);
  return res;
}
const int N = 1005, M = 5e5 + 5;
int n, m, sum;
int a[N], b[N];
bitset<M> epc[N];
bool ba[N], bb[N];
inline void solve() {
  register int i, j, k;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]), ba[i] = 0;
  scanf("%d", &m);
  for (i = 1; i <= m; i++) scanf("%d", &b[i]), bb[i] = 0;
  if (n != m) return puts("No"), void();
  for (sum = 0, i = 1; i <= n; i++) sum += a[i];
  if (sum & 1) return puts("No"), void();
  epc[0].reset();
  epc[0][0] = 1;
  for (i = 1; i <= n; i++) epc[i] = epc[i - 1] | epc[i - 1] << a[i];
  if (!epc[n][sum >> 1]) return puts("No"), void();
  for (k = sum >> 1; k;) {
    for (i = 1; i <= n; i++)
      if (epc[i][k]) {
        ba[i] = 1;
        k -= a[i];
        break;
      }
  }
  for (sum = 0, i = 1; i <= n; i++) sum += b[i];
  if (sum & 1) return puts("No"), void();
  epc[0].reset();
  epc[0][0] = 1;
  for (i = 1; i <= n; i++) epc[i] = epc[i - 1] | epc[i - 1] << b[i];
  if (!epc[n][sum >> 1]) return puts("No"), void();
  for (k = sum >> 1; k;) {
    for (i = 1; i <= n; i++)
      if (epc[i][k]) {
        bb[i] = 1;
        k -= b[i];
        break;
      }
  }
  for (i = 1; i <= n; i++)
    if (ba[i]) a[i] *= -1;
  for (i = 1; i <= m; i++)
    if (bb[i]) b[i] *= -1;
  int _ = 0;
  sort(a + 1, a + n + 1, greater<int>());
  sort(b + 1, b + n + 1, greater<int>());
  for (i = 1; i <= n; i++)
    if (b[i] < 0) {
      reverse(a + 1, a + i);
      reverse(b + i, b + n + 1);
      break;
    }
  puts("Yes");
  int x = 0, y = 0;
  printf("%d %d\n", x, y);
  for (i = 1; i <= n; i++) {
    y += b[i];
    printf("%d %d\n", x, y);
    x += a[i];
    if (i != n) printf("%d %d\n", x, y);
  }
  return;
}
signed main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
