A robot is trapped in a maze shaped as an M×N grid. Each cell is either empty or a wall. The robot cannot step onto a wall directly, and it can never leave the maze because the outer boundary is solid. The robot does carry a drill, however: spending 1 unit of energy turns one wall cell into an empty cell, after which the robot may enter it.
The robot starts at a given cell and wants to reach a destination cell. In one step it moves to a cell that is horizontally or vertically adjacent. Entering an empty cell is free, but entering a wall cell requires first drilling that wall, which costs 1 unit of energy. The robot has a limited amount of stored energy.
Given the map of the maze and the amount of stored energy, decide whether the robot can reach the destination.
The first line contains an integer T (1≤T≤20), the number of test cases.
Each test case is given as follows. The first line contains an integer k (k≥0), the amount of energy stored in the robot. The next line contains two integers M and N (1≤M≤500, 1≤N≤500), the number of rows and columns of the maze. Each of the following M lines contains exactly N characters describing one row of the maze. The character * is a wall and . is an empty cell. S marks the robot start and T marks the destination. Every symbol on a maze row is separated from the next by at least one whitespace character.
For each test case, print a single line containing y if the robot can reach the destination while spending at most k units of energy, or n otherwise.