There are $$$n$$$ different postal codes $$$a_1, \ldots, a_n$$$ in Barcelona. Each postal code is a $$$5$$$-digit integer (possibly with leading zeros).
Exactly one post office is responsible for each postal code. All deliveries to a specific postal code always go to the office.
Some post offices know the contact numbers and locations of each other. To make it easier to remember, they agreed on the following:
Recently, Tommaso came to Barcelona on vacation to work as a courier. It is very important for couriers to know the contact numbers and locations of as many post offices as possible.
Since Tommaso is not familiar with the city, he decided to start with his place of residence. He will come to the post office of his place of residence and start asking for contacts and details of other post offices. Then he will visit those offices and ask them about even more offices and so on.
Tommaso does not yet know the postal code of his place of residence. You became interested: for all possible options $$$s$$$ ($$$1 \le s \le n$$$) of the post office of Tommaso's place of residence, how many different post offices will Tommaso be able to find out about if he starts from there?
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^5$$$, $$$1 \leq k \leq 5$$$).
Each of the next $$$n$$$ lines contains integers $$$a_1, \dots, a_n$$$ ($$$00\,000 \le a_i \le 99\,999$$$) — all the different postal codes of Barcelona, written with exactly $$$5$$$ digits.
Output exactly $$$n$$$ integers: the number of different post offices that Tommaso will be able to find out about if he starts from the office with number $$$s$$$ ($$$1 \le s \le n$$$).
4 1 02345 02355 12345 85475
3 3 3 1
3 5 12345 25876 57805
2 2 1