http://codeforces.com/contest/1236/problem/C
#include <bits/stdc++.h>
//#include <cmath>
//#include <iostream>
//#include <unordered_map>
#define mem(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define INF 0x3f3f3f3f
#define ll long long
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int mod=1e9+7;
const int N=2e5+9;
vector<int>ans[309];
int main()
{
FAST_IO;
int n;
cin>>n;
int cnt=0;
int f=1;
for(int i=1;i<=n*n;i++)
{
//cout<<i<<endl;
if(((i-1)/n)%2==0)
ans[(i-1)%n].pb(i);
else ans[(n-i%n+n)%n].pb(i);
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<ans[i][j]<<" ";
}
cout<<endl;
}
return 0;
}