#include <iostream>
#include <map>
using namespace std;

int main() {
    int a, b;
    while (cin >> a >> b) { 
        map<int,int> record;//书号,次数
        int ren[100000];
        for(int i=1;i<=a;i++)
        {
            int shuhao;cin>>shuhao;
            ren[i]=shuhao;
            record[shuhao]++;
        }
        for(int i=1;i<=a;i++)
        {
            if(record[ren[i]]==1)cout<<"BeiJu"<<endl;
            else
             cout<<record[ren[i]]-1<<endl;
        }

    }
}