K. Snake (A)
time limit per test
1 second
memory limit per test
64 megabytes
input
standard input
output
standard output

Dr. Rawan’s son loves to play computer games. His favorite game includes a snake that moves around a room tryig to reach an exit door. Dr. Rawan thought that this can make a good assignment for her AI class. As a warmup, she asked her students to write a program that checks if a certain sequence of moves will make the snake reach the exit door or not.

You are given the state of the snake on a 16×32 grid and a sequence of moves represented using the following symbols:

< : move left > : move right v : move down ^ : move up

The body of the snake is also represented on the grid using the same symbols, where each symbol represents the direction taken by the snake at that cell. Your task is to check if the snake can reach the exit cell using the given sequence or not.

The following example shows how the snake moves on the grid for the sequence: >^>

E represents the exit cell, and the colon ‘:’ represents the head of the snake. Note that all the body of the snake moves simultaneously.

Input

Each line of the first 16 lines of input contains 32 characters, which represent the state of the snake on the grid.

The following line contains a non-empty string with no more than 256 characters representing the sequence of moves that should be taken by the snake.

It is guaranteed that the given sequence will not cause the snake to go out of the borders of the gird, nor make the snake intersect itself.

The given sequence will also not cause the snake to reach the exit cell and continue moving over it.

Output

Print "Yes" if the snake reaches the exit cell using the given sequence and print "No" otherwise.

Examples
Input
................................
................................
................................
................................
................................
................................
..........>v.:<<<...............
........E..v....^...............
...........v....^...............
...........>>>>>^...............
................................
................................
................................
................................
................................
................................
<<v<<<
Output
Yes