#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define INF 1000000000000000000 typedef pair pll; typedef pair pint; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { int mod = (2 * i - j) % N; if (mod <= 0) mod += N; cout << mod << " "; } cout << endl; } }