#include #include using namespace std; using namespace atcoder; using ll = long long; using ull = unsigned long long; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const vector dx = {0,0,1,-1}; const vector dy = {1,-1,0,0}; const ll INF = 1e18; const ll inf = 1e8; const ll MOD = 998244353; int main(){ int n,k; cin >> n >> k; vector ans; for(int i = 0; i < n; i++){ string s = ""; for(int j = 0; j < n; j++){ char a; cin >> a; for(int p = 0; p < k; p++) s += a; } for(int j = 0; j < k; j++) ans.push_back(s); } for(auto i : ans) cout << i << endl; }