Cipher square
Statement
  Goal
Given a 5 x 5 grid of letters where top-left is (0, 0), output the decoded lines of text.A B C D E
J I H G F
K L M N O
T S R Z P
Q/U V W X Y
Decode example: 13 = (1, 3) = S
There are no words with double U to decode, so no vacuum. You need to handle the 04 case where there could be a Q or a U.
- single 04 is a U
- double 04 is a Q followed by U
Input
      Line 1: An integer N for the number of lines to decode.
Next N lines: Space sparated integer pairs XY for each letter coordinate
   Next N lines: Space sparated integer pairs XY for each letter coordinate
Output
      N lines of decoded text
   Constraints
      1≤ N ≤ 10
0 < x,y < 5
   0 < x,y < 5
Example
      Input
            1 21 40 12 12 42
Output
            HELLO
Game modes
   Fastest,  Shortest  
 Test cases
  Example Test  
 Input
 1
21 40 12 12 42
 Output
 HELLO
  Validator 1  Validator 
 Input
 1
20 21 40 20 02
 Output
 CHECK
  2 lines Test  
 Input
 2
03 24 42
12 11 32 40 13
 Output
 TWO
LINES
  Validator 2  Validator 
 Input
 2
22 42 23 40
12 11 32 40 13
 Output
 MORE
LINES
  U per line Test  
 Input
 4
04 43
01 04 13 03
10 04 13 03
41 12 04
 Output
 UP
JUST
BUST
FLU
  Validator 3  Validator 
 Input
 3
04 13 40
44 42 04 23
31 32 04
 Output
 USE
YOUR
GNU
  No double U Test  
 Input
 2
04 04 40 40 32
00 04 04 00 23 11 04 13
 Output
 QUEEN
AQUARIUS
  Validator 5  Validator 
 Input
 2
04 04 11 20 02
00 04 04 00 23 11 04 22
 Output
 QUICK
AQUARIUM
  The Quick Brown Fox Test  
 Input
 10
03 21 40
04 04 11 20 02
10 23 42 24 32
41 42 34
01 04 22 43 13
42 14 40 23
03 21 40
12 00 33 44
30 42 31 13
10 00 20 02
 Output
 THE
QUICK
BROWN
FOX
JUMPS
OVER
THE
LAZY
DOGS
BACK
  Validator 6  Validator 
 Input
 10
03 24 42
04 04 11 20 02
10 23 42 24 32
41 42 34 40 13
01 04 22 43
42 14 40 23
03 21 40
12 00 33 44
30 42 31 13
10 00 20 02
 Output
 TWO
QUICK
BROWN
FOXES
JUMP
OVER
THE
LAZY
DOGS
BACK
 Solution language
  Solution
 Stub generator input