#t287. 潜在朋友
潜在朋友
Potential Friends
Problem Background
Special for beginners, ^_^
Problem Description
"Birds of a feather flock together" — that is the phrase we like to use when describing friends. Two people being friends usually means they share many common interests. However, as a homebody at Peking University, you find you do not get many chances to know others. Luckily, you unexpectedly obtained the library borrowing records of Peking University, so you stayed up all night programming, hoping to discover potential friends from them.
First you organized the borrowing records: you numbered the readers in order as , and the books as . Following the principle of "birds of a feather", anyone who likes the same book as you do is your potential friend. Your task now is to compute, from this borrowing record, how many potential friends each person has.
Input Format
The first line contains two integers ().
The following lines: the -th line () contains one number, the ID () of reader 's favourite book.
Output Format
lines in total, one number per line. The -th line is the number of potential friends reader has.
If reader shares a favourite book with nobody, output BeiJu (a tragedy, ^ ^).
Sample Input
4 5
2
3
2
1
Sample Output
1
BeiJu
1
BeiJu
Constraints
Time limit: 1s, memory limit: 1024KiB for each test case.