#54545: Python解答


kita197 (KK)


citys = {"A":10,"B":11,"C":12,"D":13,"E":14,"F":15,"G":16,"H":17,"I":34,"J":18,"K":19,"L":20,"M":21,
         "N":22,"O":35,"P":23,"Q":24,"R":25,"S":26,"T":27,"U":28,"V":29,"W":32,"X":30,"Y":31,"Z":33}
while True:
        try:
                try:
                        t = int(input())
                except:
                        c += 1
                a, b, c = 0, 0, 0
                seen = []
                for _ in range(t):
                    ID = input().strip()
                    if len(ID) != 10 or ID[1] not in ['1', '2'] or ID[0] not in citys:
                        c += 1
                        continue
                    n = citys[ID[0]]
                    total = (n // 10) + (n % 10) * 9
                    weights = [8, 7, 6, 5, 4, 3, 2, 1]
                    for i in range(8):
                        total += int(ID[i+1]) * weights[i]
                    total += int(ID[9])
                    if total % 10 == 0:
                        if ID in seen:
                            b += 1
                        else:
                            a += 1
                            seen.append(ID)
                    else:
                        c += 1
                print(f"{a},{b},{c}")
        except:
                break