#include using namespace std; int main(){ int n; cin >> n; for (int i=1; i < n; ++i) { for (int j=1; j < n; ++j) { vector> moves = {{i,j},{i,-j},{-i,j},{-i,-j},{j,i},{j,-i},{-j,i},{-j,-i}}; vector> board(n, vector(n, -1)); board[0][0] = 0; int moveCount = 0; bool keepTrying = true; while (keepTrying) { ++moveCount; keepTrying = false; for (int x=0; x < n; ++x) { for (int y=0; y < n; ++y) { if (board[x][y] == moveCount-1) { for (auto m : moves) { int newX = x + m.first; int newY = y + m.second; if (newX >= 0 && newX < n && newY >= 0 && newY < n && board[newX][newY] == -1) { board[newX][newY] = moveCount; if (newX != n-1 || newY != n-1) keepTrying = true; else { keepTrying = false; break; } } } } } } } cout << board[n-1][n-1] << " "; } cout << endl; } return 0; }