#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
bitset<1000001> dp[1001];
int x[1001], y[1001], a[1001];
bool vis[1001];
int main() {
  int T;
  scanf("%d", &T);
  dp[0][0] = 1;
  while (T--) {
    int h;
    scanf("%d", &h);
    int sum = 0, ok = 0, cnt = 0, cnt2 = 0;
    for (int i = (1); i < (h + 1); ++i)
      scanf("%d", &a[i]), sum += a[i], vis[i] = 0;
    sort(a + 1, a + 1 + h, [](int x, int y) { return x > y; });
    if (sum & 1) ok = 1;
    if (!ok) {
      for (int i = (1); i < (h + 1); ++i)
        dp[i] = dp[i - 1] | (dp[i - 1] << a[i]);
      if (!dp[h][sum >> 1])
        ok = 1;
      else {
        int pos = sum >> 1;
        for (int i = (h + 1) - 1; i >= (1); --i) {
          if (!dp[i - 1][pos]) {
            vis[i] = 1;
            pos -= a[i];
          }
        }
        for (int i = (1); i < (h + 1); ++i) {
          if (vis[i]) x[++cnt] = a[i];
        }
        for (int i = (1); i < (h + 1); ++i)
          if (!vis[i]) x[++cnt] = -a[i];
      }
    }
    scanf("%d", &h);
    sum = 0;
    for (int i = (1); i < (h + 1); ++i)
      scanf("%d", &a[i]), sum += a[i], vis[i] = 0;
    sort(a + 1, a + 1 + h);
    if (sum & 1) ok = 1;
    if (!ok) {
      for (int i = (1); i < (h + 1); ++i)
        dp[i] = dp[i - 1] | (dp[i - 1] << a[i]);
      if (!dp[h][sum >> 1])
        ok = 1;
      else {
        int pos = sum >> 1;
        for (int i = (h + 1) - 1; i >= (1); --i) {
          if (!dp[i - 1][pos]) {
            vis[i] = 1;
            pos -= a[i];
          }
        }
        for (int i = (1); i < (h + 1); ++i) {
          if (vis[i]) y[++cnt2] = a[i];
        }
        for (int i = (1); i < (h + 1); ++i)
          if (!vis[i]) y[++cnt2] = -a[i];
      }
    }
    dp[0].reset();
    dp[0][0] = 1;
    if (ok || cnt != cnt2) {
      puts("No");
    } else {
      puts("Yes");
      int px = 0, py = 0, id = 1, id2 = 1;
      for (int t = (0); t < (cnt + cnt2); ++t) {
        printf("%d %d\n", px, py);
        if (~t & 1)
          px += x[id++];
        else
          py += y[id2++];
      }
    }
  }
}
