“Don’t wanna walk alone. So, let’s get married.”
Little Y lives in a strange town, which can be represented by a finite 2D plane. Each grid point on the 2D plane has a unique number. The unique number is generated by breadth first search. The origin point (0,0) is numbered as 0. We search for the points which is not accessed yet (in the order of top, right, bottom, left) and number them with the smallest available positive number.
$$
\begin{matrix}
& & 5 & & \\
& 7 & 1 & 6 & \\
\cdots & 4 & 0 & 2 & 8 \\
& \cdots & 3 & 9 & \\
& & \cdots & &
\end{matrix}
$$
For example, the point (1,-1) is for 9 and the point 6 is at (1,1).
One day, Little Y met Little K and quickly fell in love.
Little Y wants to follow Little K’s steps. Surprisingly, Little K will publish his location.
Once noticing the location, Little Y will go to that point. However, Little Y is not clever and need your help.