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: 48ms
Memory: 25316kB
Author: 13666594886
In contest: 1296

score={10:"A",9:"A",8:"B",7:"C",6:"OK",5:"ARE YOU PIG?",
       4:"ARE YOU PIG?",3:"ARE YOU PIG?",2:"ARE YOU PIG?",
       1:"ARE YOU PIG?",0:"ARE YOU PIG?"}
n,m=map(int,input().split())
d={}
for tcase in range(n):
    a=input().split()
    d[a[0]]=int(a[2])

for tcase in range(m):
    print(score[d[input()]//10])