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;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int h;
    cin >> h;
    vector<int> l(h);
    for (int j = 0; j < h; j++) {
      cin >> l[j];
    }
    int v;
    cin >> v;
    vector<int> p(v);
    for (int j = 0; j < v; j++) {
      cin >> p[j];
    }
    if (h != v) {
      cout << "No" << endl;
    } else {
      int lsum = 0;
      for (int j = 0; j < h; j++) {
        lsum += l[j];
      }
      int psum = 0;
      for (int j = 0; j < v; j++) {
        psum += p[j];
      }
      if (lsum % 2 == 1 || psum % 2 == 1) {
        cout << "No" << endl;
      } else {
        vector<vector<bool>> dph(h + 1, vector<bool>(lsum / 2 + 1, false));
        dph[0][0] = true;
        for (int j = 0; j < h; j++) {
          dph[j + 1] = dph[j];
          for (int k = lsum / 2; k >= l[j]; k--) {
            if (dph[j][k - l[j]]) {
              dph[j + 1][k] = true;
            }
          }
        }
        vector<vector<bool>> dpv(v + 1, vector<bool>(psum / 2 + 1, false));
        dpv[0][0] = true;
        for (int j = 0; j < v; j++) {
          dpv[j + 1] = dpv[j];
          for (int k = psum / 2; k >= p[j]; k--) {
            if (dpv[j][k - p[j]]) {
              dpv[j + 1][k] = true;
            }
          }
        }
        if (!dph[h][lsum / 2] || !dpv[v][psum / 2]) {
          cout << "No" << endl;
        } else {
          int hc = lsum / 2;
          vector<int> ha, hb;
          for (int j = h - 1; j >= 0; j--) {
            if (!dph[j][hc]) {
              ha.push_back(l[j]);
              hc -= l[j];
            } else {
              hb.push_back(l[j]);
            }
          }
          int vc = psum / 2;
          vector<int> va, vb;
          for (int j = v - 1; j >= 0; j--) {
            if (!dpv[j][vc]) {
              va.push_back(p[j]);
              vc -= p[j];
            } else {
              vb.push_back(p[j]);
            }
          }
          if (va.size() == ha.size()) {
            sort(ha.rbegin(), ha.rend());
            sort(hb.rbegin(), hb.rend());
            sort(va.begin(), va.end());
            sort(vb.begin(), vb.end());
            cout << "Yes" << endl;
            int x = 0, y = 0;
            for (int j = 0; j < va.size(); j++) {
              x += ha[j];
              cout << x << ' ' << y << endl;
              y += va[j];
              cout << x << ' ' << y << endl;
            }
            for (int j = 0; j < vb.size(); j++) {
              x -= hb[j];
              cout << x << ' ' << y << endl;
              y -= vb[j];
              cout << x << ' ' << y << endl;
            }
          }
          if (ha.size() < va.size()) {
            vector<int> h1, v1;
            for (int j = 0; j < ha.size(); j++) {
              h1.push_back(ha[j]);
              v1.push_back(va[j]);
            }
            vector<int> h2, v2;
            for (int j = 0; j < va.size() - ha.size(); j++) {
              h2.push_back(hb[j]);
              v2.push_back(va[j + ha.size()]);
            }
            vector<int> h3, v3;
            for (int j = 0; j < h - va.size(); j++) {
              h3.push_back(hb[j + (va.size() - ha.size())]);
              v3.push_back(vb[j]);
            }
            sort(h1.rbegin(), h1.rend());
            sort(v1.begin(), v1.end());
            sort(h2.begin(), h2.end());
            sort(v2.rbegin(), v2.rend());
            sort(h3.rbegin(), h3.rend());
            sort(v3.begin(), v3.end());
            cout << "Yes" << endl;
            int x = 0, y = 0;
            for (int j = 0; j < h1.size(); j++) {
              x += h1[j];
              cout << x << ' ' << y << endl;
              y += v1[j];
              cout << x << ' ' << y << endl;
            }
            for (int j = 0; j < h2.size(); j++) {
              x -= h2[j];
              cout << x << ' ' << y << endl;
              y += v2[j];
              cout << x << ' ' << y << endl;
            }
            for (int j = 0; j < h3.size(); j++) {
              x -= h3[j];
              cout << x << ' ' << y << endl;
              y -= v3[j];
              cout << x << ' ' << y << endl;
            }
          }
          if (ha.size() > va.size()) {
            vector<int> h1, v1;
            for (int j = 0; j < va.size(); j++) {
              h1.push_back(ha[j]);
              v1.push_back(va[j]);
            }
            vector<int> h2, v2;
            for (int j = 0; j < ha.size() - va.size(); j++) {
              h2.push_back(ha[j + va.size()]);
              v2.push_back(vb[j]);
            }
            vector<int> h3, v3;
            for (int j = 0; j < h - ha.size(); j++) {
              h3.push_back(hb[j]);
              v3.push_back(vb[j + (ha.size() - va.size())]);
            }
            sort(h1.begin(), h1.end());
            sort(v1.rbegin(), v1.rend());
            sort(h2.rbegin(), h2.rend());
            sort(v2.begin(), v2.end());
            sort(h3.begin(), h3.end());
            sort(v3.rbegin(), v3.rend());
            cout << "Yes" << endl;
            int x = 0, y = 0;
            for (int j = 0; j < h1.size(); j++) {
              y += v1[j];
              cout << x << ' ' << y << endl;
              x += h1[j];
              cout << x << ' ' << y << endl;
            }
            for (int j = 0; j < h2.size(); j++) {
              y -= v2[j];
              cout << x << ' ' << y << endl;
              x += h2[j];
              cout << x << ' ' << y << endl;
            }
            for (int j = 0; j < h3.size(); j++) {
              y -= v3[j];
              cout << x << ' ' << y << endl;
              x -= h3[j];
              cout << x << ' ' << y << endl;
            }
          }
        }
      }
    }
  }
}