#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n;
    cin>>n;
    if (n==2){
        cout<<1<<" "<<3<<endl;
        cout<<4<<" "<<2<<endl;
    }
    else if (n==3){
        cout<<1<<" "<<6<<" "<<4<<endl;
        cout<<2<<" "<<5<<" "<<3<<endl;
    }
    return 0;
}