Game
Grandpa Marat cherishes his granddaughter Masha, especially since she is the youngest in his family. He often engages her in various games.
Today, they played a cognitive game called "Guess the Word." The rules are straightforward:
First, Grandpa thinks of a word. This word is any sequence of lowercase Latin letters, with the condition that it must be a palindrome. A string S of length n is a palindrome if for every i in the range 1 to n, S[i] = S[n - i + 1].
In each turn, Masha can select any word P and append it to S, either on the left or the right.
If the resulting string is not a palindrome, Grandpa informs Masha, and the game concludes.
If the resulting string remains a palindrome, the game continues.
When the game ends, Masha must identify the word Grandpa initially thought of.
Grandpa has documented all of Masha's moves during the game. He now wishes to recall how the game concluded. If Masha successfully guessed the word, he wants to know what it was. Otherwise, he needs to determine if she failed because there were multiple possibilities or if he made an error during the game.
Input
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 3000)—the length of the word Grandpa thought of and the number of moves in the game, respectively.
The following m lines each contain a word s_i, composed of lowercase Latin letters, representing the word Masha chose on the i-th move. The total length of all s_i combined does not exceed 3000.
The last line contains a string w with m characters, each being either L or R. w_i = L indicates that the word s_i was appended to the left of the current string on the i-th move, while w_i = R indicates it was appended to the right.
Output
Print Unique if Masha can uniquely determine the word Grandpa thought of, Ambiguous if there could be multiple such words, or Impossible if no such word exists and Grandpa made a mistake.