m, n = list(map(int, input().split(" ")))#示例真坑,多了个空格
book = []
ans = [0 for i in range(m)]
for i in range(m):
    book.append(int(input()))
for j in range(m):
    for k in range(m):
        if book[j] == book[k] and j != k:
            ans[j] += 1
for x in ans:
    if x != 0:
        print(x)
    else:
        print("BeiJu")