#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;

constexpr int mod = 1e9 + 7;
constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ld eps = 1e-9;

#define fast_io() ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
#define sz(x) ((int)(x).size())

void solve() {
    int n, m, k; cin >> n >> m >> k;
    vector<string> vc(n);
    for (auto& x : vc) cin >> x;
    for (int i = 0; i < n; i++) {
        string cur;
        for (char ch : vc[i]) {
            for (int j = 0; j < k; j++) cur += ch;
        }
        for (int j = 0; j < k; j++) cout << cur << '\n';
    }
}

int main() {
    fast_io();
    freopen("cowsignal.in", "r", stdin);
    freopen("cowsignal.out", "w", stdout);
    int t = 1;
//    cin >> t;
    while (t--) solve();
    return 0;
}