Popular on-line game "Attack Of The Moderns 3" is played by two teams of 5 players each.
During the match, players run around the map and try to kill members of opposing team
by attacking them with various weapons and magic spells.
Killed players respawn after a certain period of time.

Players of the first team are numbered from 1 to 5, players of the second team are numbered from 6 to 10.
All attacks are recorded by the game for statistics gathering.
Each attack is described by values t, a, v, k,
where t is a time in seconds since the game start, a — the number of the attacking player,
v — the number of the player being attacked, k = 1 if this attack killed the victim and 0 otherwise.

Gank is an event when one or more players attack and kill a single opponent
while his teammates are elsewhere and unable to help.
Specifically: let G be a set of players who attacked the victim during
the last T seconds of the game before the kill.
A kill is counted as a gank, if in that period of time:

the victim only attacked players from set G, and

players from set G attacked and were attacked only by the victim.

All the players from the set G who attacked the victim of the gank are considered the participants of this gank.

Your program must, given the value of T and a sequence of N attack descriptions,
count the number of ganks each player has participated in.

Input file format

Input file contains integers NT followed by N quartets of integers t_{i}a_{i}v_{i}k.

Output file format

Output file must contain 10 integers — the numbers of ganks for each player.

Constraints

1 ≤ N ≤ 10000, 1 ≤ t_{i} ≤ t_{i + 1} ≤ 10^{5}, 1 ≤ T ≤ 10^{5}.
Either 1 ≤ a_{i} ≤ 5 < v_{i} ≤ 10 or 1 ≤ v_{i} ≤ 5 < a_{i} ≤ 10.
Time between sequential kills of the same victim is greater than T.