team=[]
y=0
name=[]
for i in range(3):
team.append(list(map(str,input().split())))
#print(team[i])
team.sort(key=lambda x:x[1])
# print(team)
for i in range(3):
team[i][0]=int(team[i][0])
y=int(team[i][1])%100
print(y,end="")
if i==2:
print("")
team.sort(key=lambda x:x[0],reverse=True)
# print(team)
for i in range(3):
name.append(team[i][2])
print(name[i][0],end="")
cro=['c=','c-','dz=','d-','lj','nj','s=','z=']
# cnt=0
word=input()
for i in cro:
word=word.replace(i,'*') #replace(찾을값,바꿀값)
# print(word)
print(len(word))
n=int(input())
temp=[]
cnt=0
past=0
for i in range(n):
word=str(input())
for i in word:
# print(i)
if i not in temp or past==i:
temp.append(i)
past=i
else:
cnt+=1
break
past=0
temp=[]
print(n-cnt)
n=int(input())
xypq=[]
cnt=0
answer=[]
for _ in range(n):
xypq.append(list(map(int,input().split())))
for i in range(n): #0 1 2 3 4
cnt=0
for j in range(n):
if not i==j: # 1 2 3 4/0 2 3 4/0 1 3 4/0 1 2 3
if xypq[i][0]<xypq[j][0] and xypq[i][1]<xypq[j][1]:
cnt+=1
answer.append(cnt+1)
print(*answer)