Breed Counting
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Several seasons of hot summers and cold winters have significantly damaged Farmer John's fence for cows, which are lined up in a row and consecutively numbered from to . Each cow belongs to one of three breeds: – Holsteins, — Guernseys, — Jerseys. Farmer John asks you to count the number of cows of each breed within a given range.
Input
The first line contains two integers and .
Each of the next lines contains one integer, , or , which is the breed identifier of the corresponding cow.
The following lines describe the queries, each consisting of two integers and .
Output
For each of the queries , print a line containing three integers — the number of cows of each breed in the interval from to , inclusive.
Examples
Input #1
Answer #1
Submissions 202
Acceptance rate 63%