Programmer's University (PU) sponsors a number of intramural sports tournaments throughout the year. The brackets showing the competing teams and the winners are displayed on a metal board using magnetic signs that carry the team names. One such bracket is shown below.
Every so often a prankster takes all of the team name signs off the board and lays them on the floor in pairs, in column-major order: starting at the top of Round 1 and moving down that column, then back to the top of Round 2 and down that column, and so on. The prankster leaves a note claiming that any programmer ought to be able to recreate the exact bracket from just this information. Your task is to write a program that reads the team names from a tournament bracket and draws that bracket using simple ASCII characters.
Round Round Round Winner
1 2 3
_BIG__
\_BIG_____
_DIGS_/ \
\_FIGURES_
/ \
_FIGURES_/ \
\
\_TIGGER_
/
_TIGGER__ /
\ /
\_TIGGER__/
_WIG__ /
\_WIG_____/
_ZIG__/
One complication is that a tournament may not have enough teams to completely fill a bracket, so some teams do not have to play a first-round match (they receive a bye). It is up to you to deduce which teams actually played in the first round.
The input contains data for one or more tournaments. Tournaments are numbered implicitly, starting at 1.
Each tournament begins with a line containing a positive odd integer $n$ ($3 \le n \le 31$), the total number of name signs in the bracket. This is followed by $(n + 1)/2$ lines of team pairings. Every line except the last contains exactly two team names separated by a single space; the first name is the one printed immediately above the second in the output. The last line contains a single team name: the winner of the tournament.
All team names consist of 3 to 7 uppercase letters (A-Z).
A line containing the single value -1 signals the end of the input.
For each tournament, first print a line identifying it: Tournament 1, Tournament 2, and so on. Then print the bracket itself.
Team names are printed left-justified with one leading underscore _ and one or more trailing underscores. The width of a round is the length of the longest team name in that round plus one leading and one trailing underscore. Teams that play in the first round are printed 2 lines apart; teams in the second, third, and fourth rounds (if the bracket is large enough) are 4, 8, and 16 lines apart, respectively.
Contrary to the usual guideline, lines that do not begin with a first-round team may start with spaces, and consecutive spaces may appear where the formatting requires them. However, no line may have trailing spaces, no line may consist only of spaces, and there must be no completely empty lines. The only symbols needed to draw the bracket are the forward slash /, the backslash \, and the underscore _. The largest bracket possible in this problem has $n = 31$.