from collections import defaultdict from collections import Counter def main(): n = int(input()) d = defaultdict(int) for _ in range(n): s, c = input().split() d[s] = int(c) c = Counter(d.values()) for i in range(8): print(c[i]) if __name__ == "__main__": main()