#!/bin/python import sys n = int(raw_input().strip()) # your code goes here res = [[0] * (n-1) for _ in xrange(n-1)] from Queue import Queue def search(a, b, n): q = Queue() q.put((0, 0, 0)) vis = set() while not q.empty(): step, x, y = q.get() vis.add((x, y)) for dx, dy in (a, b), (a, -b), (-a, b), (-a, -b), (b, a), (b, -a), (-b, a), (-b, -a): nx, ny = x+dx, y+dy if 0 <= nx < n and 0 <= ny < n and (nx, ny) not in vis: if (nx, ny) == (n-1, n-1): return step+1 q.put((step+1, nx, ny)) vis.add((nx, ny)) return -1 for i in xrange(1, n): for j in xrange(i, n): res[i-1][j-1] = res[j-1][i-1] = search(i, j, n) for row in res: print ' '.join([str(n) for n in row])