#include using namespace std; #define REP(i,n) for(int i=0;i ostream& operator<<(ostream& os,const vector& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; } typedef long long ll; typedef unsigned long long ull; typedef pair pii; typedef vector vi; typedef vector vvi; int dx[4] = {0,1,0,-1}; int dy[4] = {1,0,-1,0}; int main(){ int n; cin >> n; vector> table(n,vector(n,0)); int x=0,y=0; int f=0; for(int i=1;i<=n*n;i++){ table[x][y]=i; int nx=x+dx[f]; int ny=y+dy[f]; if(nx<0 or nx>=n or ny<0 or ny>=n or table[nx][ny]!=0){ f = (f+1) % 4; } x = x + dx[f]; y = y + dy[f]; } for(int i=0;i