#include <iostream>

using namespace std;

const int NMAX = 5001;

int n, m, x;
int a[NMAX];

int main()
{
    ios::sync_with_stdio(false);
    cin >> n >> m >> x;
    int y;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            cin >> y;
            for (int k = (j - 1) * x + 1; k < j * x + 1; ++k)
                a[k] = y;
        }
        for (int j = 1; j <= x; ++j) {
            for (int k = 1; k <= m * x; ++k)
                cout << a[k] << ' ';
            cout << '\n';
        }
    }
    return 0;
}