#include <bits/stdc++.h>
 
#define inf cin //for testing
#define outf cout
 
using namespace std;
vector<string> pict;
 
int main()
{
    //ifstream inf("maze1.in");
    //ofstream outf("maze1.out");
    //cout << setprecision(10);
   
    int w, h;
    inf >> w >> h;
   
    string take;
    getline(inf, take); //move down a line, >> operator does not take in \n after two numbers
   
   
    string ch;
   
    for (int i = 0; i < 2*h+1; i++)
    {
        getline(inf, ch);
        pict.push_back(ch);
       
    }
   
 
    //Will never print on 25x25 maze
 
    for (int i = 0; i < 2*h+1; i++)
    {
        outf << pict[i] << endl;
    }
 
    return 0;
 
}