n = gets.to_i
ans = Array.new(n){[-1]*n}
if n % 2 == 1
  i = 2
  ans[0][1] = 1
  ans[0][2] = 1
  ans[1][2] = 2
else
  i = 1
  ans[0][1] = 1
end

while i < n
  ans[i][i+1] = 1
  (i+1).times do |j|
    ans[j][i] = 2
    ans[j][i+1] = 2
  end
  i += 2
end

(n-1).times do |i|
  puts ans[i][i+1,n-1].join(" ")
end