The cows have revised their game of leapcow. They now play in the middle of a huge pasture upon which they have marked a grid that bears a remarkable resemblance to a chessboard of N rows and N columns (3 <= N <= 365).
Here's how they set up the board for the new leapcow game:
* First, the cows obtain N x N squares of paper. They write the integers from 1 through N x N, one number on each piece of paper.
* Second, the 'number cow' places the papers on the N x N squares in an order of her choosing.
Each of the remaining cows then tries to maximize her score in the game.
* First, she chooses a starting square and notes its number.
* Then, she makes a 'knight' move (like the knight on a chess board) to a square with a higher number. If she's particularly strong, she leaps to the that square; otherwise she walks.
* She continues to make 'knight' moves to higher numbered squares until no more moves are possible.
Each square visited by the 'knight' earns the competitor a single point. The cow with the most points wins the game.
Help the cows figure out the best possible way to play the game.