def print_map(m,n):
  for i in range(n):
    for j in range(n):
      if j == 0:
        h = ''
      else:
        h = ' '
      print(h + str(m[i][j]), end = '')
    print()

def calc_distance(r,m,n):
  p = r[0]
  total_dist = 0
  for i in range(1,n):
    np = r[i]
    dist = m[p][np]
    total_dist += dist
    p = np
  return total_dist

N=int(input())
Map = [[0 for i in range(N)] for j in range(N)]
#print_map(Map,N)
dist = 1
for i in range(N):
  for j in range(N):
    if i == j:
      continue
    if Map[i][j] != 0 or Map[j][i] != 0:
      continue
    Map[i][j] = dist
    Map[j][i] = dist
    #print(i,j,dist)
    dist += 1
#print_map(Map,N)

route_seed = [i for i in range(N)]
import itertools
route = list(itertools.permutations(route_seed))
for i in range(len(route)):
  dist_list = []
  #print(route[i])
  r = route[i]
  dist = calc_distance(r,Map,N)
  if dist in dist_list:
    print('same distance')
    break
  dist_list.append(dist)
print_map(Map,N)