In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
We shall consider sequences that meet the following conditions:
A single sequence will be called a code.
When two codes are given we estimate their compatibility giving two numbers. The first one (column A in the example) is the sum of those digits that occur in both codes and appear on the same positions in both sequences, whilst the second number (column B) is the sum of those digits that occur in both codes but appear on different positions.
We are given codes and their compatibility estimations with some unknown code. One should find and present the unknown code. Sample data and a result for are presented below.
Write a program which:
Your program should read the description from the standard input. In the first line there is one integer , . In the following lines there are the descriptions of the given codes of digits and the estimations of their compatibility with some unknown code, one per line. In each of the lines there are non-negative integers separated by single spaces. The first and the second number are the estimation of compatibility of the given code with the unknown one, and the last numbers are different digits from the range of 1-9 forming the given code.
Your program should write to the standard output. There should be different digits from the range of 1-9 forming the code to be found, separated by single spaces.
You may assume that for the test data there is at least one solution. If for the input data there exist many satisfying codes, your program should write out only one of them (arbitrary).
For the input data:
3 4 0 4 9 7 0 10 6 7 4 0 5 9 4 1
the correct result is:
4 1 6
Task author: Zbigniew Czech.