Start: Jul, 17, 2019 00:00:00
20190717Python程序设计基础培训扩展练习
End: Jul, 21, 2019 00:00:00
Time elapsed:
Time remaining:

Problem_ID: C
Result: Accepted
Time: 46ms
Memory: 25200kB
Author: 15924081415
In contest: 1296

x,y=map(int,input().split())
dic1={}
dic2={10:'A',9:'A',8:'B',7:'C',6:'OK'}
for i in range(x):
    n,m,s=input().split()
    dic1[n]=[n,int(s)]
    
for j in range(y):
    cj=dic1[input()][1]

    if cj<60:
        print("ARE YOU PIG?")
    else:
        print(dic2[cj//10])