#include <bits/stdc++.h>
#include <cstring>
using namespace std;
int main() {
    int n, m;
    while (cin >> n >> m) {
        int a[m + 1];
        memset(a, 0, sizeof(a));
        int temp[n];
        for (int i = 0 ; i < n ; i++) {
            int number;
            cin >> number;
            temp[i] = number;
            a[number] ++;
        }
        for (int i =  0 ; i < n ; i++) {
            if (a[temp[i]] > 1) cout << a[temp[i]] - 1 << endl;
            else cout << "BeiJu" << endl;
        }
    }
}