drew a shut polyline on a plane, that comprised distinctly of vertical and even sections (corresponding to the arrange tomahawks). The sections switched back and forth among flat and vertical ones (an even fragment was constantly trailed by an upward one, as well as the other way around). The polyline didn't contain severe self-convergences, which implies that in the event that any two fragments shared a typical point, that point was an endpoint for
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
One drew a shut polyline on a plane, that comprised distinctly of vertical and even sections (corresponding to the arrange tomahawks). The sections switched back and forth among flat and vertical ones (an even fragment was constantly trailed by an upward one, as well as the other way around). The polyline didn't contain severe self-convergences, which implies that in the event that any two fragments shared a typical point, that point was an endpoint for the two of them (kindly counsel the models in the notes area).
Sadly, the polyline was deleted, and you just know the lengths of the horizonal and vertical portions. Kindly develop any polyline coordinating with the portrayal with such sections, or establish that it doesn't exist.
Input
The primary line contains one integer t (1≤t≤200) — the number of experiments.
The primary line of each experiment contains one integer h (1≤h≤1000) — the number of even fragments. The accompanying line contains h integers l1,l2,… ,lh (1≤li≤1000) — lengths of the even fragments of the polyline, in discretionary request.
The accompanying line contains an integer v (1≤v≤1000) — the number of vertical portions, which is trailed by a line containing v integers p1,p2,… ,pv (1≤pi≤1000) — lengths of the upward sections of the polyline, in subjective request.
Experiments are isolated by a clear line, and the amount of qualities h+v over all experiments doesn't surpass 1000.
Output
For each experiment output Yes, if there exists something like one polyline fulfilling the prerequisites, or No in any case. In the event that it exists, in the accompanying n lines print the directions of the polyline vertices, arranged by the polyline crossing: the I-th line ought to contain two integers xi and yi — directions of the I-th vertex.
Note that, each polyline fragment should be either level or vertical, and the sections should shift back and forth among flat and vertical. The directions ought not surpass 109 by their outright worth.
Step by step
Solved in 4 steps with 1 images