Many people are familiar with the logic game "Bulls and Cows." Let's outline the rules of a similar game. One player thinks of a six-digit number (without leading zeros), ensuring all digits are unique. The second player attempts to guess this number by suggesting other six-digit numbers (also without leading zeros). For each guess, the first player provides feedback in the form of two numbers: the count of digits that are in the correct positions (the number of bulls) and the count of digits that are present in the number but in different positions (the number of cows). For example, if the secret number is and the guess is , the response would be " bull and cows" (the first digit is correct, and one and one are present but misplaced).
Given the game's history (the guesses and their corresponding feedback), determine whether the secret number can be uniquely identified.
The first line contains an integer – the number of turns, where 1 \le N \le 10000. The following lines each contain three natural numbers, X_i, Y_i, Z_i, separated by spaces. Here, X_i is a six-digit number without leading zeros, Y_i is the number of "bulls," and Z_i is the number of "cows."
Output if the number can be uniquely determined, and if it cannot.
Example 1