Breed Counting#11159

Breed Counting

1 second
128 megabytes
Very easy

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 q~(1 \le n, q \le 10^5).

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 b~(a \le b).

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

Example 1

Loading
Loading