#include using namespace std; vector> buildCells(int h, int w) { vector> cells; cells.reserve(h * w); for (int row = 0; row < h; row++) { if (row % 2 == 0) { for (int col = 0; col < w; col++) { cells.push_back({row, col}); } } else { for (int col = w - 1; col >= 0; col--) { cells.push_back({row, col}); } } } return cells; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int h; int w; int m; cin >> h >> w >> m; if (h % 2 != 0 || w % 2 != 0 || m == 0) { cout << -1 << '\n'; return 0; } int total = h * w; int k = m - 1; int low = 1; int high = total; int middle = k + 1; vector> grid(h, vector(w)); vector> cells = buildCells(h, w); for (int t = 1; t <= total; t++) { auto [row, col] = cells[t - 1]; if (t <= 2 * k) { if (t % 2 == 1) { grid[row][col] = low++; } else { grid[row][col] = high--; } } else { grid[row][col] = middle++; } } for (int row = 0; row < h; row++) { for (int col = 0; col < w; col++) { if (col > 0) { cout << ' '; } cout << grid[row][col]; } cout << '\n'; } return 0; }