Problem

16 /19


gas station

Problem

Gasoline marked 92, 95 and 98 is sold at gas stations (gas stations). In the city of N, gasoline prices were monitored at various gas stations. 

Write a time- and memory-efficient program that will determine for each type of gasoline how many gas stations sell it the cheapest. 

The input to the program in the first line is the number of data N about the cost of gasoline. Each of the following N lines contains information in the following format: 
<Company> <Street> <Brand> <Price>

where <Company> – a string of no more than 20 characters without spaces;
- <Street> – a string of no more than 20 characters without spaces;
- <Brand> – one of the numbers – 92, 95 or 98;
- <Price> – an integer in the range from 1000 to 3000, indicating the cost of one liter of gasoline in kopecks. 

<Company> and <Street>, <Street> and <Brand> as well as <Brand> and <Price> separated by a single space.

Input string example: 
Sinoil Tsvetochnaya 95 2250 
The program should display space-separated 3 numbers – the number of gas stations selling the cheapest gasoline grades 92, 95 and 98, respectively. If gasoline of some brand was not sold anywhere, then output 0. 

Sample output: 
12 1 0