Distribution Center

Given conveyor lanes and connector arms between adjacent lanes, count for each lane how many starting lanes can reach it.

Medium7GraphUnion-findImplementationNo attempts yetTime limit3sMemory limit512 MB

Problem

A factory has nn manufacturing lines and the same number of storage rooms. It also has the same number of conveyor lanes, laid out in parallel, that carry goods from each manufacturing line straight to the matching storage room. The plan is to install robot arms at several points between pairs of adjacent lanes. A robot arm picks goods up from one of the two lanes and puts them down on the other, and it works in the opposite direction too. Goods from different manufacturing lines then get mixed among the storage rooms.

The positions of the robot arms decide which storage rooms the goods of each manufacturing line can reach. Given the number of conveyor lanes and the positions of the robot arms, find, for each storage room, how many manufacturing lines can deliver goods to it.

Input

The input is a single test case in the following format.

n m
x1 y1
...
xm ym

The integer nn (2n2000002 \le n \le 200000) on the first line is the number of conveyor lanes. The lanes are numbered from 1 to nn, and two lanes whose numbers differ by 1 are adjacent. Every lane starts at x=0x = 0 and ends at x=100000x = 100000. The other integer mm (1m<1000001 \le m < 100000) is the number of robot arms.

Each of the following mm lines gives the position of a robot arm as two integers xix_i (0<xi<1000000 < x_i < 100000) and yiy_i (1yi<n1 \le y_i < n). At x=xix = x_i, the ii-th robot arm picks goods up from lane yiy_i or lane yi+1y_i + 1 and puts them down on the other lane at the same xx coordinate. Each item passing a robot arm independently either switches lanes there or stays on its lane.

No two robot arms share an xx coordinate, that is, xixjx_i \ne x_j whenever iji \ne j.

The figure above shows the layout of the first example input.

Output

Print nn integers on one line, separated by a space. The ii-th integer is the number of manufacturing lines whose goods the storage room attached to conveyor lane ii can accept.