In the previous mission, Bee Agent User333 performed excellently, so he has now been dispatched on a mission to Pollen Kingdom, an ally of Honey Kingdom.
Pollen Kingdom, a nation established by butterflies, also organizes its areas in a regular hexagonal (正六邊形) pattern due to historical reasons. This means the map of Pollen Kingdom consists entirely of hexagonal cells.
To facilitate development, they use a unique coordinate system where each hexagonal cell is represented by coordinate (x,y) as shown below:
The map is structured such that the first row has coordinates:
(1,1) , (1,2) , ... , (1,M)
The second row then has:
(2,1) , (2,2) , ... , (2,M)
...
In this system, each cell (x,y) is positioned between (x−1,y) and (x−1,y+1).
For any cell located at (x,y), its neighboring cells are:
(x-1,y) , (x-1,y+1) , (x,y-1) , (x,y+1) , (x+1,y-1) , (x+1,y)
Agent User333 has been assigned T missions, each with a different map. On each map, the starting point is always (1,1), and the destination is (N,M).
Each cell on the map contains specific information represented by Ai,j :
Whenever User333 arrive at a magic circle, you can choose one of the following options:
Agent User333 has been assigned T missions, each with a different map. On each map, the starting point is always (1,1), the destination is (N,M), and he has C bottles of magic potion for that mission.
The first line of input contains a positive integer T, representing the number of maps.
For each map, the input is structured as follows:
The next N lines each contain M entries:
A1,1 , A1,2 , ... , A1,MConstraints
For each map, output a single line containing "YES" if it is possible to reach the destination from the start point, and "NO" otherwise (without quotes).
Please remember to print "\n" at the end of each line.