A higher resolution is required to access the IDE
- 184
Statement
Goal
In the classic code-breaking game of Bulls and Cows, your opponent chooses a- Each bull indicates a digit in your guess that exactly matches the value and position of a digit in your opponent's secret number.
- Each cow indicates a digit in your guess that matches the value of a digit in your opponent's secret number, but is in the wrong position.
So for example, if the secret number is
You will be given a series of guesses along with the number of bulls and cows in each guess. Your job is to determine the secret number based on the given information.
NOTE: This version of the game deviates from the classic Bulls and Cows rules in that digits may be repeated any number of times in the secret number.
Input
Line 1: The number N of guesses.
Next N lines: A guess, consisting of4 digits [0-9], followed by a space, then the number of bulls, another space, and then the number of cows.
Next N lines: A guess, consisting of
Output
The 4 -digit secret number.
Constraints
1 ≤ N ≤ 20
0≤ bulls+cows ≤ 4
0≤ bulls+cows ≤ 4
Example
Input
1 1234 4 0
Output
1234
A higher resolution is required to access the IDE