#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,k; cin >> n >> k; vector<string> s(n); for(auto &nx : s){cin >> nx;} for(int i=0;i<n*k;i++){ for(int j=0;j<n*k;j++){ cout << s[i/k][j/k]; }cout << "\n"; } return 0; }