Grammy is a puzzle master. Today, she is playing a variant of "Herugolf" puzzle.
The puzzle consists of an infinitely large square grid. Initially, there is a golf ball at the origin
(0,0)(0,0)(0,0). A strength parameter
nnn is given so that you can hit the ball
at most nnn times.
However, assume the ball is at
(xs,ys)(x_s,y_s)(xs,ys) before the
(i+1)(i+1)(i+1)-th hit, there are only
444 possible ways to hit the ball:
-
Move right through segment (xs,ys)−(xs+n−i,ys)(x_s,y_s)-(x_s+n-i,y_s)(xs,ys)−(xs+n−i,ys), and land on (xs+n−i,ys)(x_s+n-i,y_s)(xs+n−i,ys)
-
Move left through segment (xs,ys)−(xs−n+i,ys)(x_s,y_s)-(x_s-n+i,y_s)(xs,ys)−(xs−n+i,ys), and land on (xs−n+i,ys)(x_s-n+i,y_s)(xs−n+i,ys)
-
Move up through segment (xs,ys)−(xs,ys+n−i)(x_s,y_s)-(x_s,y_s+n-i)(xs,ys)−(xs,ys+n−i), and land on (xs,ys+n−i)(x_s,y_s+n-i)(xs,ys+n−i)
-
Move down through segment (xs,ys)−(xs,ys−n+i)(x_s,y_s)-(x_s,y_s-n+i)(xs,ys)−(xs,ys−n+i), and land on (xs,ys−n+i)(x_s,y_s-n+i)(xs,ys−n+i)
Note that the ball will
not fall into the hole on the segment.
Additionally, the ball should not visit a point twice. During a hit, each point on the segment is considered visited by the ball.
The goal is to hit the golf ball into the only hole
(x,y)(x,y)(x,y).

The left picture illustrates an empty puzzle, and the right picture shows a solution to the puzzle.
Grammy surely knows how to solve the puzzle, but she decided to give you a quiz. Please solve the puzzle.