HZNUOJ


Problem_ID: C
Result: Accepted
Time: 49ms
Memory: 25316kB
Author: 13566285241
In contest: 1300

x,y=map(int,input().split())
d={10:'A',9:'A',8:'B',7:'C',6:'OK'}
a={}
for i in range(x):
   s=input().split()
   a[s[0]]=[s[1],int(s[2])]
for t in range(y):
    score=a[input()][1]
    if score>=60:
        print(d[score//10])
    else:
        print("ARE YOU PIG?")