#include <vector>
#include <array>
#include <iostream>

using namespace std;

bool onboard(int n, int x, int y)
{
    return x >= 0 && x < n && y >=0 && y < n;
}

int minmoves(int n, int a, int b)
{
    vector<vector<bool>> board(n, vector<bool>(n));
    board[0][0] = true;

    int moves = 0;
    
    using coords = vector<pair<int, int>>;
    coords last { make_pair(0, 0) };
    
    while(!last.empty())
    {
        ++moves;
        coords next;
        
        for(const auto& p: last)
        {
            array<int, 2> da = {a, -a};
            array<int, 2> db = {b, -b};

            for(int dx: da)
            {
                for(int dy: db)
                {
                    int x = p.first + dx;
                    int y = p.second + dy;

                    if( x == n - 1 && y == n - 1)
                        return moves;

                    if(onboard(n, x, y) && !board[x][y])
                    {
                        board[x][y] = true;
                        next.emplace_back(x, y);
                    }
                }
            }

            for(int dx: db)
            {
                for(int dy: da)
                {
                    int x = p.first + dx;
                    int y = p.second + dy;

                    if( x == n - 1 && y == n - 1)
                        return moves;

                    if(onboard(n, x, y) && !board[x][y])
                    {
                        board[x][y] = true;
                        next.emplace_back(x, y);
                    }
                }
            }
        }
        last = move(next);
    }
    
    return -1;
}

int main(){
    int n;
    cin >> n;
    
    vector<vector<int>> result(n - 1, vector<int>(n - 1));
    
    for(int a = 1; a < n; ++a)
    {
        for(int b = a; b < n; ++b)
        {
            result[a - 1][b - 1] =
                result[b - 1][ a - 1] = minmoves(n, a, b);          
        }
    }
    
    for(const auto& raw: result)
    {
        for(int x: raw)
            cout << x << ' ';
        cout << endl;
    }
    
    return 0;
}