a=int(input())
name=[0]*a
email=[0]*a
mob=[0]*a
bg=[0]*a
for i in range(a):
print("Enter the details of donor",i+1)
name[i]=str(input())
email[i]=str(input())
mob[i]=str(input())
bg[i]=str(input())
print("Enter the required blood group")
bgr=str(input())
f=0
for i in range(a):
if(bgr==bg[i]):
print("Details of matched donor")
f=1
print(name[i])
print(email[i])
print(mob[i])
print(bg[i])
if(f==0):
print("No donor with required blood group")
set2=list(map(str,input().split(',')))
print('choice one option 1)add 2)remove 3)difference 4)intersection ')
n=int(input())
print('choice one 1)set1 2)set2')
p=int(input())
if(n==1):
st=str(input())
if(p==1):
a=set(set1)
a.add(st)
print("set("+str(list(sorted(a)))+")")
elif(p==2):
a=set(set2)
a.add(st)
print("set("+str(list(sorted(a)))+")")
else:
print('invalid choice')
elif(n==2):
st=str(input())
if(p==1):
a=set(set1)
a.remove(st)
print("set("+str(list(sorted(a)))+")")
elif(p==2):
a=set(set2)
a.remove(st)
print("set("+str(list(sorted(a)))+")")
else:
print('invalid choice')
elif(n==3):
if(p==1):
a=set(set1)
b=set(set2)
c=list(sorted(a.difference(b)))
print("set("+str(c)+")")
elif(p==2):
a=set(set1)
b=set(set2)
c=list(sorted(b.difference(a)))
print("set("+str(c)+")")
else:
print('invalid choice')
elif(n==4):
if(p==1):
a=set(set1)
b=set(set2)
c=list(sorted(a.intersection(b)))
print("set("+str(c)+")")
elif(p==2):
a=set(set1)
b=set(set2)
c=list(sorted(b.intersection(a)))
print("set("+str(c)+")")
else:
print('invalid choice')