C. Nafis and Strings
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given $$$20$$$ decimal strings (a decimal string is a string consisting of characters 0 to 9) each of length $$$k$$$ ($$$k$$$ is a multiple of $$$10$$$).

You have to generate a decimal string of length $$$19k/10$$$ such that at least $$$2$$$ of the given strings are present as subsequences (not necessary contiguous) of the generated string and print it.

If it is impossible to find such a string, print -1.

Input

In the first line of input, there is an integer $$$k$$$ $$$( 1 \le k \le 10^5, k=0 \mod 10)$$$ indicating the length of each decimal string.

Then there will be $$$20$$$ lines, each line contains a decimal string of length $$$k$$$.

Output

If it's not possible to generate such string print -1. Otherwise print the generated string.

Example
Input
10
7700016673
2682666656
9125573603
6504317949
8140497834
4290279009
5173510951
8685927577
1004290788
4034247449
9343949853
0130496522
3483892793
8172454939
4720140085
1788032517
0749973594
3126125302
5156648552
9045810227
Output
6508143179490497834
Note

In the first test case, you'll find the $$$4$$$th string 6508143179490497834 and $$$5$$$th string 6508143179490497834 in the output.