import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static int count = 0; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // your code goes here for (int i=1;i=0){ if (!moves[x + i][y -j]){ moves[x + i][y -j] = true; return findMoves(x+i, y -j, i, j, n, moves); } } if (x + j <= n && y - i >=0){ if (!moves[x + j][y - i]){ moves[x + j][y - i] = true; return findMoves(x + j, y - i, i, j, n, moves); } } if (x-i >= 0 && y + j <= n) { if (!moves[x - i][y + j]){ moves[x - i][y + j] = true; return findMoves(x - i, y + j, i, j, n, moves); } } if (x - j>=0 && y + i <=n){ if (!moves[x-j][y + i]){ moves[x-j][y + i] = true; return findMoves(x-j, y + i, i, j, n, moves); } } if (x -i >= 0 && y - j >= 0) { if (!moves[x - i][y - j]){ moves[x - i][y - j] = true; return findMoves(x - i, y - j, i, j, n, moves); } } if (x - j >= 0 && y - i >= 0){ if (!moves[x-j][y-i]){ moves[x-j][y-i] = true; return findMoves(x-j, y - i, i, j, n, moves); } } return -1; } } }