PRLOTS - Transposition of string

no tags 

Sue and Mary want to communicate a secret between themselves. They decide to use the transposition to encode their data. Given the string and the transposition list, help them write the encrypted string. For example, if string is APPLE and transposition list is 3→2→5→1→4, Encrypted string is PPEAL. Length of string (l <= 1000)

Input

The first line contains the number of input strings t (0 <= t <= 100) followed by the string and the corresponding transposition list.

Output

The encrypted strings.

Example

Input:
2
Hello
3
2
5
1
4
World
2
5
3
1
4 Output: leoHl
odrWl

hide comments
nadstratosfer: 2018-07-14 05:59:28

Something is wrong with the input file, AC seems possible in C only.


Added by:kousik
Date:2013-08-30
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP JAVA PYTHON PYTHON3 PY_NBC RUBY
Resource:Own