#include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, M, K; cin >> N >> M >> K; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { cout << ((i * K) + j) % M + 1 << " "; } cout << "\n"; } return 0; }