Problem: One drew a closed polyline on a plane, that consisted only of vertical and horizontal segments (parallel to the coordinate axes). The segments alternated between horizontal and vertical ones (a horizontal segment was always followed by a vertical one, and vice versa). The polyline did not contain strict self-intersections, which means that in case any two segments shared a common point, that point was an endpoint for both of them (please consult the examples in the notes section).

Unfortunately, the polyline was erased, and you only know the lengths of the horizonal and vertical segments. Please construct any polyline matching the description with such segments, or determine that it does not exist.

Input

The first line contains one integer t (1 ≤ t ≤ 200) —the number of test cases.

The first line of each test case contains one integer h (1 ≤ h ≤ 1000) — the number of horizontal segments. The following line contains h integers l_1, l_2, ..., l_h (1 ≤ l_i ≤ 1000) — lengths of the horizontal segments of the polyline, in arbitrary order.

The following line contains an integer v (1 ≤ v ≤ 1000) — the number of vertical segments, which is followed by a line containing v integers p_1, p_2, ..., p_v (1 ≤ p_i ≤ 1000) — lengths of the vertical segments of the polyline, in arbitrary order.

Test cases are separated by a blank line, and the sum of values h + v over all test cases does not exceed 1000.

Output

For each test case output Yes, if there exists at least one polyline satisfying the requirements, or No otherwise. If it does exist, in the following n lines print the coordinates of the polyline vertices, in order of the polyline traversal: the i-th line should contain two integers x_i and y_i — coordinates of the i-th vertex.

Note that, each polyline segment must be either horizontal or vertical, and the segments should alternate between horizontal and vertical. The coordinates should not exceed 10^9 by their absolute value.

Examples

Input


2
2
1 1
2
1 1

2
1 2
2
3 3


Output


Yes
1 0
1 1
0 1
0 0
No


Input


2
4
1 1 1 1
4
1 1 1 1

3
2 1 1
3
2 1 1


Output


Yes
1 0
1 1
2 1
2 2
1 2
1 1
0 1
0 0
Yes
0 -2
2 -2
2 -1
1 -1
1 0
0 0


Input


2
4
1 4 1 2
4
3 4 5 12

4
1 2 3 6
2
1 3


Output


Yes
2 0
2 3
3 3
3 7
4 7
4 12
0 12
0 0
No

Note

In the first test case of the first example, the answer is Yes — for example, the following picture illustrates a square that satisfies the requirements: 

<image>

In the first test case of the second example, the desired polyline also exists. Note that, the polyline contains self-intersections, but only in the endpoints: 

<image>

In the second test case of the second example, the desired polyline could be like the one below: 

<image>

Note that the following polyline is not a valid one, since it contains self-intersections that are not endpoints for some of the segments: 

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("O3", "fast-math")
#pragma GCC target("tune=native,avx,avx2")
using namespace std;
constexpr int kN = int(1E3 + 10), kW = int(25E4 + 10);
short l[kN], p[kN];
bitset<kW> posh[kN >> 2], posv[kN >> 2];
bitset<kN> bs;
void malay_dp(short n, unsigned char k, int s, int kkW, vector<short> &v1,
              vector<short> &v2, short *a) {
  pair<short, pair<short, int>> now;
  vector<vector<unsigned char>> dp[2];
  vector<vector<short>> from[2];
  dp[0] = vector<vector<unsigned char>>(n - k + 1, vector<unsigned char>(kkW));
  dp[1] = vector<vector<unsigned char>>(n - k + 1, vector<unsigned char>(kkW));
  from[0] = vector<vector<short>>(n - k + 1, vector<short>(kkW));
  from[1] = vector<vector<short>>(n - k + 1, vector<short>(kkW));
  short nxt;
  int tot = 0;
  for (int i = 1; i <= k; i++) tot += a[i];
  for (int i = 0; i <= n - k; i++)
    for (int j = 0; j < kkW; j++) dp[0][i][j] = dp[1][i][j] = k + 1;
  dp[0][0][tot] = 0;
  for (int i = 0; i <= n - k; i++) {
    for (int j = 0; j < kkW; j++)
      if (dp[1][i][j] <= k)
        for (int p = dp[1][i][j] + 1; p <= min(dp[1][i - 1][j], k); p++)
          if (j >= a[p] && dp[0][i][j - a[p]] > p) {
            dp[0][i][j - a[p]] = p;
            from[0][i][j - a[p]] = i + 4000 + k;
          }
    if (i < n - k)
      for (int j = 0; j < kkW; j++)
        if (dp[0][i][j] <= k) {
          if (dp[0][i + 1][j] > dp[0][i][j]) {
            dp[0][i + 1][j] = dp[0][i][j];
            from[0][i + 1][j] = i + 2000 + k;
          }
          if (j + a[i + 1 + k] < kkW &&
              dp[1][i + 1][j + a[i + 1 + k]] > dp[0][i][j]) {
            dp[1][i + 1][j + a[i + 1 + k]] = dp[0][i][j];
            from[1][i + 1][j + a[i + 1 + k]] = i + k;
          }
        }
  }
  now = {0, {n, s}};
  bs.reset();
  for (int i = 1; i <= k; i++) bs[i] = true;
  while (now.second.first > k) {
    nxt = from[now.first][now.second.first - k][now.second.second];
    if (nxt >= 4000) {
      nxt -= 4000;
      bs[dp[now.first][now.second.first - k][now.second.second]] = false;
      now = {
          1,
          {nxt, now.second.second +
                    a[dp[now.first][now.second.first - k][now.second.second]]}};
    } else if (nxt >= 2000)
      now = {0, {nxt - 2000, now.second.second}};
    else {
      bs[now.second.first] = true;
      now = {0,
             {now.second.first - 1, now.second.second - a[now.second.first]}};
    }
  }
  for (int i = 1; i <= n; i++)
    if (bs[i])
      v1.push_back(a[i]);
    else
      v2.push_back(a[i]);
  return;
}
void solve() {
  int h, v, x = 0, y = 0, toth = 0, totv = 0;
  vector<short> hA, hB, vA, vB, H, V;
  scanf("%d", &h);
  for (int i = 1; i <= h; i++) scanf("%hd", &l[i]);
  scanf("%d", &v);
  for (int i = 1; i <= v; i++) scanf("%hd", &p[i]);
  if (h != v) goto No;
  for (int i = 1; i <= h; i++) toth += l[i];
  for (int i = 1; i <= v; i++) totv += p[i];
  if ((toth & 1) || (totv & 1)) goto No;
  posh[0][0] = posv[0][0] = true;
  for (int i = 1; i <= h / 2; i++) posh[i].reset();
  for (int i = 1; i <= h; i++)
    for (int j = min(h / 2, i); j >= 1; j--) posh[j] |= posh[j - 1] << l[i];
  for (int i = 1; i <= v / 2; i++) posv[i].reset();
  for (int i = 1; i <= v; i++)
    for (int j = min(v / 2, i); j >= 1; j--) posv[j] |= posv[j - 1] << p[i];
  toth >>= 1, totv >>= 1;
  for (int i = h / 2; i >= 1; i--)
    if (posh[i][toth]) {
      malay_dp(h, i, toth, 1000 * (i + 1) + 1, hB, hA, l);
      goto Findv;
    }
  goto No;
Findv:
  for (int i = v / 2; i >= 1; i--)
    if (posv[i][totv]) {
      malay_dp(v, i, totv, 1000 * (i + 1) + 1, vA, vB, p);
      goto Yes;
    }
No:
  printf("No\n");
  return;
Yes:
  printf("Yes\n");
  sort(hA.begin(), hA.end());
  sort(hB.begin(), hB.end());
  sort(vA.begin(), vA.end(), greater<short>());
  sort(vB.begin(), vB.end(), greater<short>());
  for (short i : hA) H.push_back(i);
  for (short i : hB) H.push_back(i);
  for (short i : vA) V.push_back(i);
  for (short i : vB) V.push_back(i);
  int sgv = 1, sgh = 1;
  for (int i = 0; i < h; i++) {
    y += V[i] * sgv;
    printf("%d %d\n", x, y);
    x += H[i] * sgh;
    printf("%d %d\n", x, y);
    if (y == totv) sgv = -sgv;
    if (x == toth) sgh = -sgh;
  }
  return;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
}