using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {

    static void Main(String[] args) {
        int n = Convert.ToInt32(Console.ReadLine());
        int x = 0;
            int y = 0;
            Dictionary<string,int> dicTmp = new Dictionary<string, int>();
            for (int i = 1; i < n; i++)
            {
                for (int j = 1; j < n; j++)
                {
                    int cnt = 0;
                    if (!dicTmp.ContainsKey(j + "-" + i))
                    {
                        while (x < n && y < n)
                        {
                            if (x + i < n && y + j < n)
                            {
                                x += i;
                                y += j;
                            }
                            else if (x + j < n && y + i < n)
                            {
                                x += j;
                                y += i;
                            }
                            else if (x + i < n && y - j < n)
                            {
                                x += i;
                                y -= j;
                            }

                            else if (x + j < n && y - i < n)
                            {
                                x += j;
                                y -= i;
                            }
                            else if (x - j < n && y + i < n)
                            {
                                x -= j;
                                y += i;
                            }
                            else if (x - i < n && y + j < n)
                            {
                                x -= i;
                                y += j;
                            }
                            else
                            {
                                break;
                            }
                            cnt++;
                        }

                        if (x == n - 1 && y == n - 1)
                        {
                            Console.Write(cnt + " ");
                        }
                        else
                        {
                            cnt = -1;
                            Console.Write("-1"+ " ");
                        }
                    }
                    else
                    {

                        Console.Write(dicTmp[j + "-" + i]+ " ");
                    }
                    dicTmp[i + "-" + j] = cnt;

                    x = 0;
                    y = 0;
                }
                Console.WriteLine();
            }
    }
}