#include <bits/stdc++.h>
struct MI {
 private:
  char bb[1 << 14];
  FILE *f;
  char *bs, *be;
  char e;
  bool o, l;

 public:
  MI() : f(stdin), bs(0), be(0) {}
  inline char get() {
    if (o) {
      o = 0;
      return e;
    }
    if (bs == be) be = (bs = bb) + fread(bb, 1, sizeof(bb), f);
    if (bs == be) {
      l = 1;
      return -1;
    };
    return *bs++;
  }
  inline void unget(char c) {
    o = 1;
    e = c;
  }
  template <class T>
  inline T read() {
    T r;
    *this > r;
    return r;
  }
  template <class T>
  inline MI &operator>(T &);
};
template <class T>
struct Q {
  const static bool U = T(-1) >= T(0);
  inline void operator()(MI &t, T &r) const {
    r = 0;
    char c;
    bool y = 0;
    if (U)
      for (;;) {
        c = t.get();
        if (c == -1) goto E;
        if (isdigit(c)) break;
      }
    else
      for (;;) {
        c = t.get();
        if (c == -1) goto E;
        if (c == '-') {
          c = t.get();
          if (isdigit(c)) {
            y = 1;
            break;
          };
        } else if (isdigit(c))
          break;
        ;
      };
    for (;;) {
      if (c == -1) goto E;
      if (isdigit(c))
        r = r * 10 + (c ^ 48);
      else
        break;
      c = t.get();
    }
    t.unget(c);
  E:;
    if (y) r = -r;
  }
};
template <>
struct Q<char> {};
template <class T>
inline MI &MI::operator>(T &t) {
  Q<T>()(*this, t);
  return *this;
}
template <class T>
std::ostream &operator<(std::ostream &out, const T &t) {
  return out << t;
}
using std::cout;
MI cin;
const int $n = 1005;
inline bool divide(std::vector<int> &arr, std::vector<int> &A) {
  static std::vector<std::bitset<500001>> can;
  static std::vector<int> B;
  const int n = arr.size();
  can.clear();
  can.resize(n + 1);
  can[0].reset();
  can[0].set(0);
  int sum = 0;
  std::sort(arr.begin(), arr.end());
  for (int i = 1; i <= n; ++i) {
    can[i] = can[i - 1] | (can[i - 1] << arr[i - 1]);
    sum += arr[i - 1];
  }
  if ((sum & 1) || !can[n].test(sum >>= 1)) return 0;
  A.clear();
  B.clear();
  for (int i = n - 1, cur = sum; ~i; --i) {
    assert(can[i + 1].test(cur));
    if (!can[i].test(cur)) {
      cur -= arr[i];
      A.push_back(arr[i]);
    } else
      B.push_back(arr[i]);
  }
  if (A.size() > B.size()) std::swap(A, B);
  std::transform(B.begin(), B.end(), std::back_inserter(A), std::negate<int>());
  return 1;
}
inline void work() {
  std::vector<int> hs, vs, xs, ys;
  hs.resize((cin.read<int>()));
  for (int &v : hs) cin > v;
  vs.resize((cin.read<int>()));
  for (int &v : vs) cin > v;
  if (hs.size() != vs.size() || !divide(hs, xs) || !divide(vs, ys))
    return (void)(cout < "No\n");
  std::reverse(ys.begin(), ys.end());
  cout < "Yes\n";
  for (int i = 0, x = 0, y = 0; i < xs.size(); ++i) {
    cout < (x += xs[i]) < ' ' < y < ('\n');
    cout < x < ' ' < (y += ys[i]) < ('\n');
  }
}
int main() {
  for (int T = (cin.read<int>()); T; --T) work();
}
