#include using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { int N, K; cin >> N >> K; vector a(N), b(N * K, string(N * K, '*')); rep(i, N) cin >> a[i]; rep(i, N) rep(j, N) { rep(k, K) rep(l, K) b[i * K + k][j * K + l] = a[i][j]; } rep(i, N * K) cout << b[i] << endl; }