Under construction

Still being built. Things may change

Toe Jumps

Time limit1sMemory limit1024 MB

Summary
Given a 2x2 grid of ice marks and a travel direction, the task is to identify which toe jump (Toe Loop, Flip, or Lutz) left the marks, or output ? if none match.
Level

Easy3 of 10

Topics
Implementation, Matrix
Solved
No attempts yet

Problem

Figure skating has six jumps: Axel, Lutz, Flip, Loop, Salchow, and Toe Loop. Jumps are divided into toe jumps and edge jumps. A jump in which the skater's toe pick touches the ice is a toe jump. The toe jumps are the Toe Loop, the Flip, and the Lutz. Below are the marks that toe jumps leave on the ice for a right-footed skater moving south (S), shown as 2×22\times2 grids.

Direction: ↓ (south, S)

.O
P.
I.
.P
O.
.P

Given a 2×22\times2 grid of marks and a direction, print which toe jump it is. The direction is one of E, W, S, or N, meaning east, west, south, or north.

Input

The first line contains one uppercase letter, E, W, S, or N, which is the direction of travel.

The next two lines contain a 2×22\times2 grid. The grid consists only of ., I, O, and P.

Output

On the first line, print the toe jump. Print T for the Toe Loop, F for the Flip, and Lz for the Lutz. If the marks match none of the toe jumps, print ?.

Examples4

  1. Example 1

    Input
    N
    P.
    .I
    
    Expected output
    F
    
  2. Example 2

    Input
    S
    O.
    .O
    
    Expected output
    ?
    
  3. Example 3

    Input
    E
    O.
    .P
    
    Expected output
    T
    
  4. Example 4

    Input
    W
    .O
    P.
    
    Expected output
    Lz