#include <bits/stdc++.h>
void solve() {
  auto partition = [&](const std::vector<int> &a) {
    int n = a.size();
    std::vector<std::bitset<500001>> f(n + 1);
    f[0] = 1;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
      f[i + 1] = f[i] | f[i] << a[i];
      sum += a[i];
    }
    if (sum & 1 || !f[n][sum / 2]) {
      return std::make_pair(false, std::vector<int>());
    }
    std::vector<int> ans1, ans2;
    int now = sum / 2;
    for (int i = n - 1; i >= 0; --i) {
      if (!f[i][now]) {
        ans1.push_back(a[i]);
        now -= a[i];
      } else {
        ans2.push_back(-a[i]);
      }
    }
    std::sort(ans1.begin(), ans1.end());
    std::sort(ans2.begin(), ans2.end(), std::greater<int>());
    std::vector<int> ans;
    ans.insert(ans.end(), ans1.begin(), ans1.end());
    ans.insert(ans.end(), ans2.begin(), ans2.end());
    return std::make_pair(true, ans);
  };
  std::vector<int> s[2];
  bool flag = true;
  for (int k = 0; k < 2; ++k) {
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for (int &v : a) {
      std::cin >> v;
    }
    auto tmp = partition(a);
    flag &= tmp.first;
    s[k].swap(tmp.second);
  }
  flag &= s[0].size() == s[1].size();
  if (!flag) {
    std::cout << "No\n";
    return;
  }
  std::reverse(s[0].begin(), s[0].end());
  for (int &x : s[0]) {
    x = -x;
  }
  auto get = [&](const std::vector<int> &a) {
    int p = 0;
    while (p < (int)a.size() && a[p] > 0) {
      ++p;
    }
    return p;
  };
  auto work = [&](std::vector<int> &a) {
    int p = 0;
    while (p < (int)a.size() && a[p] > 0) {
      ++p;
    }
    std::rotate(a.begin(), a.begin() + p, a.end());
    for (int &x : a) {
      x = -x;
    }
  };
  if (get(s[0]) > get(s[1])) {
    work(s[0]);
    work(s[1]);
  }
  std::cout << "Yes\n";
  int x = 0, y = 0;
  for (int i = 0; i < (int)s[0].size(); ++i) {
    x += s[0][i];
    std::cout << x << " " << y << "\n";
    y += s[1][i];
    std::cout << x << " " << y << "\n";
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  int T;
  std::cin >> T;
  while (T--) {
    solve();
  }
}
