#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001;
pair<vector<int>, vector<int> > solve(vector<int> L) {
  int N = (int)(L).size();
  int sum = 0;
  for (int i = 0; i < (N); i++) sum += L[i];
  if (sum % 2) {
    return {vector<int>(), vector<int>()};
  }
  sum /= 2;
  int lst[sum + 1];
  for (int i = 0; i < (sum + 1); i++) lst[i] = -1;
  lst[0] = 0;
  int sumSF = 0;
  for (int i = 0; i < (N); i++) {
    for (int j = (min(sum - L[i], sumSF) + 1) - 1; j >= 0; j--) {
      if (lst[j] != -1 && lst[j + L[i]] == -1) {
        lst[j + L[i]] = L[i];
      }
    }
    sumSF += L[i];
  }
  if (lst[sum] == -1) return {vector<int>(), vector<int>()};
  multiset<int> rem;
  for (auto& a : L) rem.insert(a);
  vector<int> fir;
  int cur = sum;
  while (cur > 0) {
    fir.push_back(lst[cur]);
    rem.erase(rem.find(lst[cur]));
    cur -= lst[cur];
  }
  vector<int> sec;
  for (auto& a : rem) sec.push_back(a);
  return {fir, sec};
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int H;
    cin >> H;
    vector<int> L(H);
    for (int i = 0; i < (H); i++) cin >> L[i];
    int V;
    cin >> V;
    vector<int> P(V);
    for (int i = 0; i < (V); i++) cin >> P[i];
    if (H != V) {
      cout << "No" << nl;
      continue;
    }
    pair<vector<int>, vector<int> > A = solve(L);
    pair<vector<int>, vector<int> > B = solve(P);
    if ((int)(A.first).size() == 0 || (int)(B.first).size() == 0) {
      cout << "No" << nl;
      continue;
    }
    if ((int)(A.first).size() > (int)(A.second).size()) {
      swap(A.first, A.second);
    }
    if ((int)(B.first).size() < (int)(B.second).size()) {
      swap(B.first, B.second);
    }
    sort(A.first.begin(), A.first.end());
    sort(A.second.begin(), A.second.end());
    reverse(A.first.begin(), A.first.end());
    reverse(A.second.begin(), A.second.end());
    sort(B.first.begin(), B.first.end());
    sort(B.second.begin(), B.second.end());
    vector<int> hor;
    for (int i = 0; i < ((int)(A.first).size()); i++) hor.push_back(A.first[i]);
    for (int i = 0; i < ((int)(A.second).size()); i++)
      hor.push_back(-A.second[i]);
    vector<int> ver;
    for (int i = 0; i < ((int)(B.first).size()); i++) ver.push_back(B.first[i]);
    for (int i = 0; i < ((int)(B.second).size()); i++)
      ver.push_back(-B.second[i]);
    int X = 0, Y = 0;
    cout << "Yes" << nl;
    for (int i = 0; i < (H + V); i++) {
      cout << X << " " << Y << nl;
      if (i % 2 == 0) {
        X += hor[i / 2];
      } else {
        Y += ver[i / 2];
      }
    }
  }
  return 0;
}
