program diverta_city
  implicit none
  integer(8) :: n, w(10,10) = 0_8, l = 23_8, v(10)
  integer :: i, j
  w(1,2) = 1_8
  w(2,1) = 1_8
  w(3,1) = 2_8
  w(1,3) = 2_8
  w(3,2) = 3_8
  w(2,3) = 3_8
  w(4,1) = 4_8
  w(1,4) = 4_8
  w(4,2) = 8_8
  w(2,4) = 8_8
  w(4,3) = 13_8
  w(3,4) = 13_8
  do i = 5, 10
    v(1) = 1_8
    v(2) = 2_8
    j = 2
    do while (j < i-1)
      j = j+1
      v(j) = v(j-2)+v(j-1)+1_8
    end do
    l = l-int(i-3,8)*int(i-2,8)/2_8
    do j = 1, i-1
      w(i,j) = l*v(j)
      w(j,i) = l*v(j)
    end do
    l = l*(v(i-2)+v(i-1)+1_8)-12_8
  end do
  read(*,*) n
  do i = 1, n
    write(*,'(i0)',advance='no') w(i,1)
    do j = 2, n
      write(*,'(x,i0)',advance='no') w(i,j)
    end do
    write(*,*)
  end do
end program diverta_city