| 2020 UP ACM Algolympics Final Round |
|---|
| Finished |
While fooling around at work today your boss, the head producer at Accelerated Creator of Movies (ACM), gives you a large list:
James Bold: Fingers
Missionary Possible: Callout
John Licks 3: Caramellum
Tom Clancy's Jack of Ryan
Fasting and Furious: Hobos with Shows
... (many more movies)
Your boss then tells you: "Slick, high-octane, spy thriller movie franchises are popular nowadays! Make $$$n$$$ movies like that!" and immediately leaves. With your jobs on the line, your hardworking team of writer-producers create the generic genre perfect spy movie scenario for you:
Seems good, right? You have just called all the agents your connections could afford, and not only they give you a list of $$$a$$$ actors to cast, but also that they have already booked the actors for the first episode! The only thing left is to decide the casting for the $$$n-1$$$ movie episodes left - but you remember that you can only change 1 slot in the cast after every movie ($$$1$$$ leaving the slot, $$$1$$$ arriving at that slot the next).
Given a list of actors $$$a$$$ and the initial lineup of $$$g$$$ cast members, list the cast changes needed to reach $$$n$$$ movies.
The first line of input contains $$$t$$$, the number of testcases.
Each test case consists of three lines:
Constraints
For each test case, output $$$n - 1$$$ lines, each containing two space-separated lowercase strings $$$a_\text{out}$$$ (actor being replaced) and $$$a_\text{in}$$$ (actor coming in).
Output a single blank line before the output of every test case except the first one.
There may be multiple valid answers; any one will be accepted.
2 2 4 4 ali bob carl dude ali bob 2 4 5 ali bob carl dude earl carl dude
bob carl carl dude ali bob dude earl carl dude dude ali
Cast list for the first test case (bold text means a cast change occured):
| Name |
|---|


