//Bai 14
#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int n;
void Run()
{
cin >> n;
int a[n][n];
int dem = 1;
for(int i = 0; i < n; i++)
{
if(i % 2 == 0)
{
for(int j = 0; j < n; j++) a[i][j] = dem++ ;
}
else
{
dem += n - 1;
for(int j = 0; j < n; j++) a[i][j] = dem--;
dem += n + 1;
}
}
for(int i = 0 ; i < n; i++)
{
for(int j = 0; j < n; j++)
{
cout << a[j][i] << " ";
}
cout << el;
}
}
int main()
{
Faster;
Run();
return 0;
}
Ly9CYWkgMTQKCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZWwgIlxuIgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIHVsbCB1bnNpZ25lZCBsb25nIGxvbmcKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBmaSBmaXJzdAojZGVmaW5lIGJlIGJlZ2luKCkKI2RlZmluZSBlbiBlbmQoKQojZGVmaW5lIEZhc3RlciBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsKaW50IG47CnZvaWQgUnVuKCkKewogICBjaW4gPj4gbjsKICAgaW50IGFbbl1bbl07CiAgIGludCBkZW0gPSAxOwogICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQogICB7CiAgICAgICBpZihpICUgMiA9PSAwKQogICAgICAgIHsKICAgICAgICAgICAgZm9yKGludCBqID0gMDsgaiA8IG47IGorKykgYVtpXVtqXSA9IGRlbSsrIDsKICAgICAgICB9CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgICAgZGVtICs9IG4gLSAxOwogICAgICAgICAgICAgICBmb3IoaW50IGogPSAwOyBqIDwgbjsgaisrKSBhW2ldW2pdID0gZGVtLS07CiAgICAgICAgICAgICAgIGRlbSArPSBuICsgMTsKICAgICAgICB9CiAgIH0KICAgZm9yKGludCBpID0gMCA7IGkgPCBuOyBpKyspCiAgIHsKICAgICAgIGZvcihpbnQgaiA9IDA7IGogPCBuOyBqKyspCiAgICAgICB7CiAgICAgICAgICAgY291dCA8PCBhW2pdW2ldIDw8ICIgIjsKICAgICAgIH0KICAgICAgIGNvdXQgPDwgZWw7CiAgIH0KfQppbnQgbWFpbigpCnsKICAgIEZhc3RlcjsKICAgIFJ1bigpOwogICAgcmV0dXJuIDA7Cn0KCg==