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

Problem_ID: C
Result: Accepted
Time: 47ms
Memory: 25196kB
Author: 13858900561
In contest: 1300

#结构-2 分数评级 2027


    
x,y=map(int,input().split())
dic={}
dic2={10:"A",9:"A",8:"B",7:"C",6:"OK"}
for i in range(x):
    n,m,s=input().split()
    dic[n]=[m,int(s)]
#print(dic)

for j in range(y):
    s_n=input()
    s_s=dic[s_n][1]
    if s_s//10<6:
        print("ARE YOU PIG?")
    else:
        print(dic2[s_s//10])