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

//习题10.6 谁是你的潜在朋友
int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> v;
	map<int, int> maps;
	for (int i = 0; i < n; i++) {
		int n;
		cin >> n;
		v.push_back(n);
		if (maps.find(n) == maps.end()) {
			maps[n] = 0;
		}
		maps[n] += 1;
	}
	for (auto it : v) {
		if (maps[it] > 1) {
			cout << maps[it] - 1 << endl;
		}
		else {
			cout << "BeiJu" << endl;
		}
	}

	return 0;
}