from __future__ import print_function from collections import deque as dq n = int(input()) paths_result = [[0] * n for _ in range(n)] def get(n, a, b): visited={(0,0)} doubly_ended_queue = dq() doubly_ended_queue.append((0, 0, 0)) while doubly_ended_queue: x, y, cost = doubly_ended_queue.popleft() if x == (n-1) and y==(n-1): return cost cost += 1 for u, v in [(a, b), (a, -b), (-a, b), (-a, -b), (b, a), (b, -a), (-b, a), (-b, -a)]: u += x v += y if 0 <= u < n and n > v >= 0 and (u, v) not in visited: visited.add((u, v)) doubly_ended_queue.append((u, v, cost)) else: return -1 for a in range(1, n): for b in range(1, a + 1): paths_result[a][b] = paths_result[b][a] = get(n, a, b) print(*map(lambda x: " ".join(map(str, x[1:])), paths_result[1:]), sep="\n")