Hide

Problem A
April Fools

/problems/liuchallenge23.aprilfools/file/statement/en/img-0001.jpeg

Julius and Marcus are notorious for their pranks. To avoid falling victim to their tricks, you must be able to decipher their plans. The problem is that they encrypt their plans using a simple substitution cipher. Specifically, they shift the letters of the alphabet by a certain number of steps.

Over the years, you have noticed that Julius and Marcus use different shift values each time. For example, if the alphabet is shifted by 3 steps, the letter A becomes D, B becomes E, and so on:

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

...

X

Y

Z

A

B

C

D

E

F

G

H

I

J

K

L

...

Your task is to write a program to decrypt the message into plain text given the encrypted message and the number of steps the alphabet is shifted. Only capital letters A-Z are scrambled. All other characters such as spaces or dots will remain the same.

Input

The first line of the input consists of a single integer $N$ $(1 \leq N \leq 100)$, the number of test cases. Each test case consists of two lines. The first line contains an integer $S$ $(0 \leq S \leq 25)$, the number of positions the alphabet is shifted. The second line contains a string of length $M$ $(1 \leq M \leq 10^3)$, the encrypted message.

Output

For each test case, output a single line containing the decrypted message.

Sample Input 1 Sample Output 1
1
5
QNZHMFQQFJSLJ
LIUCHALLAENGE
Sample Input 2 Sample Output 2
2
3
VHFUHW PHVVDJH
7
HWYPS MVVSZ!
SECRET MESSAGE
APRIL FOOLS!

Please log in to submit a solution to this problem

Log in