Algorithm

time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza". The antivirus had no objections and Igor K. run the flash application he had downloaded. Immediately his QIP Infinium said: "invalid login/password".

Igor K. entered the ISQ from his additional account and looked at the info of his main one. His name and surname changed to "H1N1" and "Infected" correspondingly, and the "Additional Information" field contained a strange-looking binary code 80 characters in length, consisting of zeroes and ones. "I've been hacked" — thought Igor K. and run the Internet Exploiter browser to quickly type his favourite search engine's address.

Soon he learned that it really was a virus that changed ISQ users' passwords. Fortunately, he soon found out that the binary code was actually the encrypted password where each group of 10 characters stood for one decimal digit. Accordingly, the original password consisted of 8 decimal digits.

Help Igor K. restore his ISQ account by the encrypted password and encryption specification.

Input

The input data contains 11 lines. The first line represents the binary code 80 characters in length. That is the code written in Igor K.'s ISQ account's info. Next 10 lines contain pairwise distinct binary codes 10 characters in length, corresponding to numbers 0, 1, ..., 9.

Output

Print one line containing 8 characters — The password to Igor K.'s ISQ account. It is guaranteed that the solution exists.

Examples
input
Copy
`010011001001011000000101100010010110010001011001100101101000010110101001011011000100110000010011001001011000000101100010010110010001011001100101101000010110101001011011000101101110`
output
Copy
`12345678`
input
Copy
`101011011110010000101001000110101011011100101101110110001000110111100101100010001001000010110111100110010001101010110111001011011111010011011011000001111001010110110110000110001000`
output
Copy
`30234919`

Code Examples

#1 Code Example with C++ Programming

```Code - C++ Programming```

``````#include <cstdio>
#include <iostream>
#include <string>
#include <map>

int main(){

const int N = 10; const int D = 10; const int L = 8;
std::string input; getline(std::cin, input);
std::map<std::string, int> digits;
for(int k = 0; k < N; k++){
std::string temp; getline(std::cin, temp);
digits.insert(std::pair<std::string, int>(temp, k));
}

for(int k = 0; k < L; k++){
std::string temp = input.substr(k * D, D);
std::cout << digits[temp];
}
puts("");

return 0;
}``````
Copy The Code &

Input

cmd
01001100100101100000010110001001011001000101100110010110100001011010100101101100
0100110000
0100110010
0101100000
0101100010
0101100100
0101100110
0101101000
0101101010
0101101100
0101101110

Output

cmd
12345678