#abc308d. [abc308_d]Snuke Maze
[abc308_d]Snuke Maze
Problem Statement
We have a grid with horizontal rows and vertical columns. We denote by the cell at the -th row from the top and -th column from the left. Each cell in the grid has a lowercase English letter written on it. The letter written on equals the -th character of a given string .
Snuke will repeat moving to an adjacent cell sharing a side to travel from to . Determine if there is a path in which the letters written on the visited cells (including initial and final ) are s
n
u
k
e
s
n
, in the order of visiting. Here, a cell is said to be an adjacent cell of sharing a side if and only if .
Formally, determine if there is a sequence of cells such that:
- ;
- is an adjacent cell of sharing a side, for all ; and
- the letter written on coincides with the -th character of
snuke
, for all .
Constraints
- and are integers.
- is a string of length consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if there is a path satisfying the conditions in the problem statement; print No
otherwise.
Sample Input 1
Sample Output 1
The path satisfies the conditions because they have s
n
u
k
written on them, in the order of visiting.