#!/bin/python import sys n = int(raw_input().strip()) res = [] for i in range(0, n - 1): res.append([None] * (n - 1)) for a in range(1, n): for b in range(1, n): step = [(0,0)] fields = [] cnt = 0 for i in range(0, n): fields.append([None] * n) while step: step_new = [] for x, y in step: fields[x][y] = cnt if x == y == n - 1: step_new = [] break if x + a < n and y + b < n and fields[x + a][y + b] is None and (x + a, y + b) not in step_new: step_new.append((x + a, y + b)) if x + b < n and y + a < n and fields[x + b][y + a] is None and (x + b, y + a) not in step_new: step_new.append((x + b, y + a)) if x - a >= 0 and y + b < n and fields[x - a][y + b] is None and (x - a, y + b) not in step_new: step_new.append((x - a, y + b)) if x - b >= 0 and y + a < n and fields[x - b][y + a] is None and (x - b, y + a) not in step_new: step_new.append((x - b, y + a)) if x + a < n and y - b >= 0 and fields[x + a][y - b] is None and (x + a, y - b) not in step_new: step_new.append((x + a, y - b)) if x + b < n and y - a >= 0 and fields[x + b][y - a] is None and (x + b, y - a) not in step_new: step_new.append((x + b, y - a)) if x - a >= 0 and y - b >= 0 and fields[x - a][y - b] is None and (x - a, y - b) not in step_new: step_new.append((x - a, y - b)) if x - b >= 0 and y - a >= 0 and fields[x - b][y - a] is None and (x - b, y - a) not in step_new: step_new.append((x - b, y - a)) step = step_new cnt += 1 res[a - 1][b - 1] = fields[n - 1][n - 1] and fields[n - 1][n - 1] or -1 for x in res: print ' '.join([str(y) for y in x])