In Byteland there are two leading video-card manufacturers, Bitotronics and 3D-Bytes. Each of their top cards is built from many nodes joined by wires that carry the processed signal. There are two kinds of node, sockets and processors, and the wiring of a single card always satisfies:
Bitthew has bought one card of each brand. By coincidence the two cards have the same number of sockets, so he joins every socket of the Bitotronics card to a distinct socket of the 3D-Bytes card with a cable (a one-to-one pairing of the sockets of the two cards).
He now wants to send a signal along a closed route that uses wires and cables, visits every node of both cards exactly once, and returns to its starting node (each two consecutive nodes on the route, and also the first and last, must be joined directly by a wire or a cable). Help Bitthew decide whether such a route exists.
The first line contains the number of test cases $T$. Each test case is given as follows.
The first line of a test case contains three integers $k$, $n$, $m$ ($2 \le k \le 1000$, $1 \le n \le 1000$, $1 \le m \le 1000$): the number of sockets on each card, the number of processors on the Bitotronics card, and the number of processors on the 3D-Bytes card. The nodes are named:
The next $n + k - 1$ lines each contain the names of two distinct Bitotronics nodes joined directly by a wire. The following $m + k - 1$ lines describe, in the same format, the wires of the 3D-Bytes card. The last $k$ lines each contain the names of two sockets on different cards joined by a cable; every socket appears on exactly one such line.
All tokens are separated by whitespace and may be read one after another.
For each test case output a single line containing YES if a closed route with the required property exists, and NO otherwise.
Only this yes/no decision is required — you do not have to print an explicit route.