Fluorography
During a fluorography examination, n Martians of k different genders have gathered. They are all lined up in a queue in a specific order. The fluorography room admits m individuals at a time, but only if they are all of the same gender. If the first person in the queue is of gender s, they will admit this person along with the next m-1 individuals of the same gender s from the queue, even if there are individuals of other genders standing before some of them. If there are fewer than m individuals of the specified gender remaining in the queue, all of them are admitted to the room, while individuals of other genders must wait. Each subsequent group of Martians enters the room one hour after the previous group, even if the previous group had fewer than m individuals.
Given the order in which individuals of all genders are lined up in the queue, determine the number of hours after the examination starts that each person will enter the fluorography room.
Input
The first line of the input file specifies the number of Martians in the queue n, the number of genders k, and the maximum group size m. All three numbers are natural numbers and do not exceed 100000. The second line contains n numbers separated by spaces. The number at the i-th position represents the gender of the person standing i-th in the queue. Gender is indicated by a natural number from 1 to k inclusive.
In 40% of the tests for this problem, n, k, and m do not exceed 1000, and in another 20% of the tests, k is no more than 10.
Output
The output file should contain n numbers separated by spaces. The number at the i-th position indicates the number of hours after the examination starts when the i-th person in the queue will enter the fluorography room.