Find the ball is one of the most interesting game in the past. Playing "Find the ball" will test and improve the player's attention and memory. In the begining of the game, There are one yellow ball will be hidden under three cups and then swaps each cup many time as fast as possible, Finally, you need to find where is the ball.

One day, a game developer thinked that using three cups to play the game is too easy. He wanted to expaned three cups to n cups and one ball to m ball. However he was no idea to write an program for the game. In order to help the game developer, you need to write a program to simulate the procedure and record the final location of each ball.
N
M S
T
A_1 B_1
A_2 B_2
N : The size of cups (3 <= N <= 40)
M : The number of balls (1<= B <= N/2, and each location of ball will not repeat)
S : The sequence of each ball's location
T : The number of instruction to swap the cup (1 <= T < 100)
A_i, B_i : The location of both two cup to swap (A_i and B_i may have same value)
Note: the location start from 1
Print out the simulated procedure and the final location of each ball from left to right.
(for simulated procedure : each line followed by a newline).
(Balls are represented by asterisk '*', and non-ball cells are represented by a minus sign '-')
(for the final location of each ball : each location should be separated by a space, and make sure there is a trailing space followed by a newline character at the end of line.)
Note: for simulated procedure should print out the initial state first