#t439. 海港
海港
The Harbor
Problem Description
Little K is a customs officer at a harbor. Every day many ships arrive at the harbor, usually carrying passengers from many different countries.
Little K is very interested in the ships arriving at the harbor, and he records the situation of each ship arriving at the harbor by time: for the -th arriving ship, he records its arrival time (in seconds), the number of passengers on board, and the nationality of each passenger.
Little K has recorded information about ships, and he hopes you can help calculate, for each ship's arrival time, how many different countries the passengers who arrived by ship within the past hours ( hours seconds) come from.
Formally, you need to compute pieces of information. For the -th piece of output information, you need to count the ships satisfying , and among all , how many different numbers there are in total.
Input Format
The first line contains a positive integer , indicating that Little K recorded information about ships.
The following lines each describe one ship: the first two integers and represent the arrival time of the ship and the number of passengers on board, and the following integers represent the nationalities of the passengers on board.
It is guaranteed that the input is increasing, in seconds; starting from when Little K first starts work, this ship arrives at the -th second.
It is guaranteed that , , , .
Here denotes the sum of all .
Output Format
Output lines; the -th line outputs an integer representing the statistical information after the -th ship arrives.
Sample Input 1
3
1 4 4 1 2 2
2 2 2 3
10 1 3
Sample Output 1
3
4
4
Sample Input 2
4
1 4 1 2 2 3
3 2 2 3
86401 2 3 4
86402 1 5
Sample Output 2
3
3
3
4
Sample Explanation 1
- The first ship arrives at the st second. The ships arriving in the last hours is the first ship, with passengers from countries , coming from different countries in total.
- The second ship arrives at the nd second. The ships arriving in the last hours are the first and second ships, with passengers from countries , coming from different countries in total.
- The third ship arrives at the th second. The ships arriving in the last hours are the first, second, and third ships, with passengers from countries , coming from different countries in total.
Sample Explanation 2
- The first ship arrives at the st second. The ships arriving in the last hours is the first ship, with passengers from countries , coming from different countries in total.
- The second ship arrives at the rd second. The ships arriving in the last hours are the first and second ships, with passengers from countries , coming from different countries in total.
- The third ship arrives at the -th second. The ships arriving in the last hours are the second and third ships, with passengers from countries , coming from different countries in total.
- The fourth ship arrives at the -th second. The ships arriving in the last hours are the second, third, and fourth ships, with passengers from countries , coming from different countries in total.
Constraints
- For of the test points, , , , .
- For of the test points, , , , .
- For of the test points, , , , .
- For of the test points, , , , .
- For of the test points, , , , .