#include using namespace std; #define mp make_pair int visited[30][30]; queue< pair > q; int main() { int N; scanf("%d", &N); for (int i = 1; i < N; i++) { for (int j = 1; j < N; j++) { while (!q.empty()) q.pop(); memset(visited, 0, sizeof(visited)); int dx[] = {-i, -i, -j, -j, j, j, i, i}; int dy[] = {j, -j, i, -i, i, -i, j, -j}; q.push(mp(1, 1)); int ans = 0; while (!q.empty()) { int qs = q.size(); for (int xx = 0; xx < qs; xx++) { pair c = q.front(); int cf = c.first, cs = c.second; q.pop(); for (int k = 0; k <= 7; k++) { if (1 <= cf + dx[k] && cf + dx[k] <= N && 1 <= cs + dy[k] && cs + dy[k] <= N && !visited[cf + dx[k]][cs + dy[k]]) { visited[cf + dx[k]][cs + dy[k]] = 1; q.push(mp(cf + dx[k], cs + dy[k])); } } } ans++; if (visited[N][N]) break; } if (visited[N][N]) printf("%d ", ans); else printf("-1 "); } printf("\n"); } }