#include <bits/stdc++.h>
using namespace std;
string s[200];
int A[200][200];
int B[200][200];
int rows, cols;
void rotate() {
  for (int i = 0; i < rows; i++)
    for (int j = 0; j < cols; j++) B[j][i] = A[i][j];
  swap(rows, cols);
  for (int i = 0; i < rows; i++)
    for (int j = 0; j < cols; j++) A[i][cols - j - 1] = B[i][j];
}
void flip() {
  for (int i = 0; i < rows; i++)
    for (int j = 0; j < cols; j++)
      if (j < (cols - j - 1)) swap(A[i][j], A[i][cols - j - 1]);
}
void scale() {
  rows *= 2;
  cols *= 2;
  for (int i = 0; i < rows; i++)
    for (int j = 0; j < cols; j++) B[i][j] = A[i / 2][j / 2];
  for (int i = 0; i < rows; i++)
    for (int j = 0; j < cols; j++) A[i][j] = B[i][j];
}
int main() {
  ios::sync_with_stdio(0);
  cin >> cols >> rows;
  for (int i = 0; i < rows; i++) {
    cin >> s[i];
    for (int j = 0; j < cols; j++) A[i][j] = (s[i][j] == '*');
  }
  rotate();
  flip();
  scale();
  for (int i = 0; i < rows; i++) {
    for (int j = 0; j < cols; j++) {
      if (A[i][j])
        cout << '*';
      else
        cout << '.';
    }
    cout << "\n";
  }
}
