def student():
name = input()
phone = input()
birth = input()
stdData = {'name':name, 'phone':phone, 'birth':birth}
return stdData
def search(k):
a = 0
while(a<k):
print(listStd[a].get('name'), end='\t' )
print(listStd[a].get('phone'), end='\t' )
print(listStd[a].get('birth') )
a=a+1
k = int(input())
a = 1
if(k>=1):
listStd = [student()]
while(a<k):
listStd.append(student())
a = a+1
while(True):
p = int(input("Input choice :"))
if(p==1):
listStd.append(student())
k=k+1
elif(p==2):
q=input()
if(q=='name'):
w=input()
for i in range(k):
if(w==listStd[i].get('name')):
del listStd[i]
elif(q=='phone'):
w=input()
for i in range(k):
if(w==listStd[i].get('phone')):
del listStd[i]
elif(q=='birth'):
w=input()
for i in range(k):
if(w==listStd[i].get('birth')):
del listStd[i]
k=k-1
elif(p==3):
search(k)
elif(p==4):
w = input()
for i in range(k):
if(w==listStd[i].get('name') or w==listStd[i].get('phone') or w==listStd[i].get('birth')):
print(listStd[i].get('name'), end='\t' )
print(listStd[i].get('phone'), end='\t' )
print(listStd[i].get('birth') )
elif(p==5):
w = input()