Problem: Before the start of the football season in Berland a strange magic ritual is held. The most experienced magicians have to find a magic matrix of the size n × n (n is even number). Gods will never allow to start the championship without it. Matrix should contain integers from 0 to n - 1, main diagonal should contain only zeroes and matrix should be symmetric. Moreover, all numbers in each row should be different. Magicians are very tired of the thinking process, so they ask you to write a program to find such matrix.

Input

The first line contains one integer n (2 ≤ n ≤ 1000), n is even.

Output

Output n lines with n numbers each — the required matrix. Separate numbers with spaces. If there are several solutions, output any.

Examples

Input

2


Output

0 1
1 0


Input

4


Output

0 1 3 2
1 0 2 3
3 2 0 1
2 3 1 0

Solution (in JAVA):

Solution:
// Don't place your source in a package


import javax.swing.*;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;



// Please name your class Main
public class Main {
    static FastScanner fs=new FastScanner();
    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int Int() {
            return Integer.parseInt(next());
        }

        long Long() {
            return Long.parseLong(next());
        }

        String Str(){
            return next();
        }
    }


    public static void main (String[] args) throws java.lang.Exception {
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        //reading /writing file
        //Scanner sc=new Scanner(new File("input.txt"));
        //PrintWriter pr=new PrintWriter("output.txt");

        int T=1;
        for(int t=0;t<T;t++){
            int n=Int();
            Solution sol=new Solution(out);
            sol.solution(n);
        }
        out.close();

    }

    public static int[] Arr(int n){
        int A[]=new int[n];
        for(int i=0;i<n;i++)A[i]=Int();
        return A;
    }
    public static int Int(){
        return fs.Int();
    }
    public static long Long(){
        return fs.Long();
    }
    public static String Str(){
        return fs.Str();
    }

}








class Solution {
    PrintWriter out;
    int INF = Integer.MAX_VALUE;
    int MOD = 1000000007;

    public Solution(PrintWriter out) {
        this.out = out;
    }



    public void solution(int n) {
        int res[][]=new int[n][n];
        for(int i=0;i<n;i++){
            res[0][i]=i;
            res[i][0]=i;
        }

        for(int i=1;i<n;i++){
            boolean seen[]=new boolean[n];
            for(int j=0;j<=i;j++){
                seen[res[i][j]]=true;
            }
            List<Integer>list=new ArrayList<>();
            for(int j=i+1;j<n;j++){
                if(!seen[res[i-1][j]]){
                    list.add(res[i-1][j]);
                }
            }

            for(int j=0;j<i+1;j++){
                if(!seen[res[i-1][j]]){
                    list.add(res[i-1][j]);
                }
            }

            int x = 0;
            for(int j=i+1;j<n;j++){
                int val =list.get((x+1)%list.size());
                res[i][j]=val;
                res[j][i]=val;
                x++;
            }
        }


        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                out.print(res[i][j]+" ");
            }out.println();
        }
    }



}