#!/bin/python3 import sys def next_step(board, target, a, b, n): mask = 0 for i in range(n): for j in range(n): if board[n+i][n+j] == target: mask = 1 if board[n + i + a][n + j + b] == 0: board[n + i + a][n + j + b] = target + 1 if board[n + i + a][n + j - b] == 0: board[n + i + a][n + j - b] = target + 1 if board[n + i + b][n + j + a] == 0: board[n + i + b][n + j + a] = target + 1 if board[n + i + b][n + j - a] == 0: board[n + i + b][n + j - a] = target + 1 if board[n + i - a][n + j + b] == 0: board[n + i - a][n + j + b] = target + 1 if board[n + i - a][n + j - b] == 0: board[n + i - a][n + j - b] = target + 1 if board[n + i - b][n + j + a] == 0: board[n + i - b][n + j + a] = target + 1 if board[n + i - b][n + j - a] == 0: board[n + i - b][n + j - a] = target + 1 if mask == 0: return board return next_step(board, target+1, a, b, n) def check_step(a, b, n): board = [] for i in range(3*n): board.append([]) for j in range(3*n): board[i].append(0) board[n][n] = 1 new_board = next_step(board, 1, a, b, n) return int(new_board[2*n-1][2*n-1] - 1) n = int(input().strip()) # your code goes here for i in range(1, n): mylist = [] for j in range(1, n): mylist.append(str(check_step(i, j, n))) print(" ".join(mylist))