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>
using namespace std;
bool divide(vector<long long>& a) {
  long long n = a.size();
  long long sum = 0;
  for (long long i = 0; i < (long long)(n); i++) {
    sum += a[i];
  }
  if (sum % 2) {
    return false;
  }
  sum /= 2;
  vector<long long> p(sum + 1, -2);
  p[0] = -1;
  long long cur_sum = 0;
  for (long long i = 0; i < n; i++) {
    long long mx = min((long long)(p.size()) - a[i], cur_sum + 1);
    for (long long j = mx - 1; j >= 0; j--) {
      if (p[j] != -2 && p[j + a[i]] == -2) {
        p[j + a[i]] = i;
      }
    }
    cur_sum += a[i];
  }
  if (p[sum] == -2) {
    return false;
  }
  while (sum) {
    a[p[sum]] *= -1;
    sum += a[p[sum]];
  }
  return true;
}
inline long long sgn(long long a) { return a < 0 ? -1 : 1; }
bool cmp1(long long a, long long b) {
  if (sgn(a) != sgn(b)) {
    return sgn(a) > sgn(b);
  }
  return abs(a) > abs(b);
}
bool cmp2(long long a, long long b) {
  if (sgn(a) != sgn(b)) {
    return sgn(a) > sgn(b);
  }
  return abs(a) < abs(b);
}
bool cmp3(long long a, long long b) {
  if (sgn(a) != sgn(b)) {
    return sgn(a) < sgn(b);
  }
  return abs(a) > abs(b);
}
bool cmp4(long long a, long long b) {
  if (sgn(a) != sgn(b)) {
    return sgn(a) < sgn(b);
  }
  return abs(a) < abs(b);
}
bool check(vector<long long>& a, vector<long long>& b) {
  long long n = a.size();
  vector<long long> l(500100, -2e18), r(500100, -2e18);
  vector<long long> l2(500100, -2e18), r2(500100, -2e18);
  vector<long long> w(500100, -2e18 + 1e3), v(500100, -2e18 + 1e3);
  vector<bool> we(500100), ve(500100);
  long long x = 250005, y = 250005;
  for (long long i = 0; i < (long long)(n); i++) {
    if (a[i] > 0) {
      we[x] = true;
      for (long long j = 0; j < (long long)(a[i] + 1); j++) {
        w[x] = y;
        x++;
      }
      x--;
      we[x] = true;
    } else {
      ve[x] = true;
      for (long long j = 0; j < (long long)(-a[i] + 1); j++) {
        v[x] = y;
        x--;
      }
      x++;
      ve[x] = true;
    }
    if (l[x] == -2e18) {
      l[x] = y;
    } else {
      l2[x] = y;
    }
    y += b[i];
    if (r[x] == -2e18) {
      r[x] = y;
    } else {
      r2[x] = y;
    }
    if (l[x] > r[x]) {
      swap(l[x], r[x]);
    }
  }
  bool ok = true;
  for (long long i = 0; i < (long long)(l.size()); i++) {
    if (l[i] < w[i] && w[i] < r[i]) {
      ok = false;
    }
    if (l[i] < v[i] && v[i] < r[i]) {
      ok = false;
    }
    if ((l[i] == w[i] || w[i] == r[i]) && !we[i]) {
      ok = false;
    }
    if ((l[i] == v[i] || v[i] == r[i]) && !ve[i]) {
      ok = false;
    }
    if (l2[i] < w[i] && w[i] < r2[i]) {
      ok = false;
    }
    if (l2[i] < v[i] && v[i] < r2[i]) {
      ok = false;
    }
    if ((l2[i] == w[i] || w[i] == r2[i]) && !we[i]) {
      ok = false;
    }
    if ((l2[i] == v[i] || v[i] == r2[i]) && !ve[i]) {
      ok = false;
    }
  }
  if (ok) {
    cout << "Yes" << endl;
    x = y = 0;
    for (long long i = 0; i < (long long)(n); i++) {
      cout << x << " " << y << endl;
      x += a[i];
      cout << x << " " << y << endl;
      y += b[i];
    }
    return true;
  }
  return false;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (long long i = 0; i < (long long)(n); i++) {
      cin >> a[i];
    }
    long long tmp;
    cin >> tmp;
    vector<long long> b(tmp);
    for (long long i = 0; i < (long long)(tmp); i++) {
      cin >> b[i];
    }
    if (n != tmp || !divide(a) || !divide(b)) {
      cout << "No" << endl;
      continue;
    }
    bool ok = false;
    for (long long k = 0; k < (long long)(2); k++) {
      for (long long i = 0; i < (long long)(4); i++) {
        if (i == 0) {
          sort(a.begin(), a.end(), cmp4);
        } else if (i == 1) {
          sort(a.begin(), a.end(), cmp1);
        } else if (i == 2) {
          sort(a.begin(), a.end(), cmp2);
        } else {
          sort(a.begin(), a.end(), cmp3);
        }
        for (long long j = 0; j < (long long)(4); j++) {
          if (j == 0) {
            sort(b.begin(), b.end(), cmp4);
          } else if (j == 1) {
            sort(b.begin(), b.end(), cmp1);
          } else if (j == 2) {
            sort(b.begin(), b.end(), cmp2);
          } else {
            sort(b.begin(), b.end(), cmp3);
          }
          if (check(a, b)) {
            ok = true;
            break;
          }
        }
        if (ok) {
          break;
        }
      }
      if (ok) {
        break;
      }
      for (long long i = 0; i < (long long)(n); i++) {
        a[i] *= -1;
      }
    }
    if (!ok) {
      cout << "No" << endl;
      continue;
    }
  }
}