#include<iostream>
#include<cstdio>
using namespace std;
int h,w;
char mm1[500][500];
char mm2[500][500];
int main(){
    while(scanf("%d%d",&h,&w) != EOF){
        getchar();
        for(int i = 1;i <= h;++i) {
            for(int j = 1;j <= w;++j){
                scanf("%c",&mm1[i][j]);
            }getchar();
        }
        for(int i = 1;i <= 2*h;++i){
            for(int j = 1;j <= w;++j){
                mm2[i][j] = mm1[(i+1)/2][j];
            }
        }
      //  printf("---\n");
        for(int i = 1;i <= 2*h;++i){
            for(int j = 1;j <= w;++j){
                printf("%c",mm2[i][j]);
            }printf("\n");
        }
    }
    return 0;
}
