
# coding: utf-8

# In[28]:


H,W = map(int,input().split())
ans = []
for i in range(H):
    S = input()
    ans.append(S)
    ans.append(S)
for i in ans:
    print(i)


# In[27]:


T


# In[26]:


X[3]=1


d7fb0d011a971026a1132146b3412df164f5581b
<mask token>

<mask token>
for i in range(H):
    S = input()
    ans.append(S)
    ans.append(S)
for i in ans:
    print(i)
T
<mask token>

H, W = map(int, input().split())
ans = []
for i in range(H):
    S = input()
    ans.append(S)
    ans.append(S)
for i in ans:
    print(i)
T
X[3] = 1


# coding: utf-8

# In[28]:


H,W = map(int,input().split())
ans = []
for i in range(H):
    S = input()
    ans.append(S)
    ans.append(S)
for i in ans:
    print(i)


# In[27]:


T


# In[26]:


X[3]=1

