#include using namespace std; typedef pair pp; int fun(int x,int y,int a,int b,int n,int visited[25][25],queue *q){ if(x+a<0 || x+a>=n || y+b<0 || y+b>=n) return 0; if(visited[x+a][y+b]==0){ visited[x+a][y+b] = visited[x][y] + 1; q->push(pp(x+a,y+b)); if(x+a == n-1 && y+b == n-1) return 2; return 1; } else return 0; } int main(){ int n; cin >> n; for(int i=1;i<=n-1;i++){ for(int j=1;j<=n-1;j++){ int visited[25][25] = {0}; pp p = pp(0,0); visited[0][0]=1; int flag=1; queue q; q.push(p); //cout << "----------------" << "\n"; while(!q.empty()){ pp f = q.front(); //cout << f.first << " " << f.second << "\n"; q.pop(); if(fun(f.first,f.second,i,j,n,visited,&q)==2 || fun(f.first,f.second,i*-1,j,n,visited,&q)==2 || fun(f.first,f.second,i,j*-1,n,visited,&q)==2 || fun(f.first,f.second,i*-1,j*-1,n,visited,&q)==2 || fun(f.first,f.second,j,i,n,visited,&q)==2 || fun(f.first,f.second,j*-1,i,n,visited,&q)==2 || fun(f.first,f.second,j,i*-1,n,visited,&q)==2 || fun(f.first,f.second,j*-1,i*-1,n,visited,&q)==2 ) break; } if(visited[n-1][n-1]==0) cout << -1; else cout << visited[n-1][n-1]-1; cout << " "; } cout << "\n"; } return 0; }