#!/bin/python import sys directions = [(1, 1), (1, -1), (-1, 1), (-1, -1)] def is_on_board(step, n): for i in xrange(2): if step[i] < 0 or step[i] >= n: return False return True def get_possible_steps(pos, a, b, n): steps = [] weights = [(a, b), (b, a)] for dir in directions: for weight in weights: step = (pos[0] + weight[0] * dir[0], pos[1] + weight[1] * dir[1]) if is_on_board(step, n): steps.append(step) return steps def get_min_path(a, b, n): board = [[-1]*n for a0 in xrange(n)] board[0][0] = 0 queue = [(0, 0)] index = 0 while index < len(queue): pos = queue[index] steps = get_possible_steps(pos, a, b, n) for step in steps: if board[step[0]][step[1]] == -1: queue.append(step) board[step[0]][step[1]] = board[pos[0]][pos[1]] + 1 if (step[0], step[1]) == (n-1,n-1): return board[n-1][n-1] index += 1 return -1 n = int(raw_input().strip()) results = [[0] * (n - 1) for i in xrange(n - 1)] for a in xrange(1,n): for b in xrange(a, n): results[a-1][b-1] = results[b-1][a-1] = get_min_path(a, b, n) for i in xrange(n - 1): print ' '.join([str(x) for x in results[i]])