// #include "pch.h"
#include <iostream>
#include <string>

using namespace std;



int main() {


	int h, w;
	string str[100];

	cin >> h >> w;

	for (int i = 0; i < h; i++) {
		cin >> str[i];
	}

	for (int i = 0; i < h; i++) {
		cout << str[i] << endl;
		cout << str[i] << endl;
	}


	//system("pause");
	return 0;
}