#include typedef long long LL; const int N = 100 + 7; int n, m; char s[N][N], t[N][N]; int main() { scanf("%d%d", &n, &m); for(int i = 0; i < n; ++i) scanf("%s", s[i]); for(int i = 0; i < n * m; ++i) for(int j = 0; j < n * m; ++j) t[i][j] = s[i / m][j / m]; for(int i = 0; i < n * m; ++i) puts(t[i]); return 0; }