#t123. 数字加密

数字加密

Digit Encryption

Problem Description

Xiaoyang has a string of digits and wants to turn it into another string of digits; this process is called encryption.

He has a codebook that tells him: which digit each digit should become.

There are 1010 digits in total: 0,1,2,3,4,5,6,7,8,90, 1, 2, 3, 4, 5, 6, 7, 8, 9.

The codebook tells, in order:

  • what 00 should become
  • what 11 should become
  • what 22 should become
  • …\dots
  • what 99 should become

Please replace every digit of the original string with the new digit according to the codebook, and output the result.

Input Format

The input consists of 33 lines in total.

  • The first line: an integer, the number of digits to be encrypted.
  • The second line: the digits to be encrypted, separated by spaces.
  • The third line: the codebook, 1010 space-separated digits in total.

The meaning of these 1010 digits is:

  • the 1st digit: what 00 becomes after encryption;
  • the 2nd digit: what 11 becomes after encryption;
  • the 3rd digit: what 22 becomes after encryption;
  • …\dots
  • the 10th digit: what 99 becomes after encryption.

Output Format

Output the encrypted digits, separated by spaces.

That is: replace each digit in the second line of input by the corresponding digit in the third line, then output.

Sample Input

7
0 2 0 3 4 1 9
9 0 1 2 3 4 5 6 7 8

Sample Output

9 1 9 2 3 0 8

Sample Explanation

The digits to be encrypted in the second line are, in order: 0,2,0,3,4,1,90, 2, 0, 3, 4, 1, 9.

The codebook in the third line is, in order: 9,0,1,2,3,4,5,6,7,89, 0, 1, 2, 3, 4, 5, 6, 7, 8.

Its meaning is:

  • 00 becomes 99
  • 11 becomes 00
  • 22 becomes 11
  • 33 becomes 22
  • 44 becomes 33
  • 55 becomes 44
  • 66 becomes 55
  • 77 becomes 66
  • 88 becomes 77
  • 99 becomes 88

Therefore, according to the mapping:

  • the 1st digit 00 becomes 99
  • the 2nd digit 22 becomes 11
  • the 3rd digit 00 becomes 99
  • the 4th digit 33 becomes 22
  • the 5th digit 44 becomes 33
  • the 6th digit 11 becomes 00
  • the 7th digit 99 becomes 88

The resulting encrypted digits are, in order: 9,1,9,2,3,0,89, 1, 9, 2, 3, 0, 8, output separated by spaces.

Constraints

The number of digits to be encrypted does not exceed 2000020000, and each digit is between 00 and 99; the digits in the codebook are distinct and are all between 00 and 99.