#include using namespace std; #define all(a) a.begin(),a.end() #define allR(v) v.rbegin(),v.rend() #define IO cin.tie(0);std::ios::sync_with_stdio(false) #define PB push_back #define PF push_front #define set(a,b) memset(a,b,sizeof(a)) #define rep(i,b,n) for(int i=b;i ii; typedef vector vii; typedef vector vi; #define INF 1000000000 const ll mod = 1000000000+7; int n; int ok(int i, int j){ return (i >=0 && j >= 0 && i < n && j < n); } ll bfs(int a, int b){ ll dist[26][26]; rep(ii, 0, 26)rep(jj, 0, 26)dist[ii][jj] = 1e12; dist[0][0] = 0; queue >q; q.push({0, 0}); while(!q.empty()){ int i = q.front().first, j = q.front().second; q.pop(); rep(k, 0, 4){ int x = dx[k], y = dy[k]; int ii = i + (x * a), jj = j + (y * b); if(ok(ii, jj) && dist[ii][jj] == 1e12){ dist[ii][jj] = dist[i][j] + 1; q.push({ii, jj}); } ii = i + (x * b), jj = j + (y * a); if(ok(ii, jj) && dist[ii][jj] == 1e12){ dist[ii][jj] = dist[i][j] + 1; q.push({ii, jj}); } } } return dist[n - 1][n- 1]; } int main(){ cin>>n; rep(a, 1, n){ rep(b, 1, n){ ll ans = bfs(a, b); cout << (ans != 1e12 ? ans : -1) << ' '; } cout << '\n'; } }