correct = list(input().split()) grades = dict() while True: temp = list(input().split()) id = temp[0] if id == "999": break answer = temp[1:] grade = 0 for i in range(len(correct)): if answer[i] == "x": continue grade += 1 if answer[i] == correct[i] else -1 grades[id] = grade for key, value in grades.items(): print("{} {} marks".format(key, value))