SP3877 CVJETICI - Cvjetici

Description

On a faraway planet, strange plants with two stems can be found. Every plant on the planet can be described by three numbers: the x-coordinates of the stems L and R, and the height H at which the stems are connect. The image depicts a plant with L=2, R=5 and H=4. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP3877/e7f7f56b085f59388be16ad70b2ab7f63fb8948d.png) Every day a new plant grows on the planet. The plant that grows on day 1 is of height 1, and every subsequent plant is one higher than the previous one. When a stem of a new plant intersects the horizontal segment of another plant, a small flower grows (if one wasn't there already). If segments merely touch in a point, a flower will not grow there. The following images are a visualization of the first example. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP3877/4d9060378144e2bdb42a00f1772cd0dc7fde19ae.png)![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP3877/4783144745f03f983238b0128aa46fd5eac25461.png)![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP3877/ddbf87ff69ebcc48c5109dd710d0737269176c2d.png)![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP3877/0a5f759830544402a08ae61bfe8a52c7fe42f1e8.png) Write a program that, given the coordinates of all plants, calculates the number of new flower every day.

Input Format

The first line contains an integer N (1 Each of the following N lines contains two integers L and R (1

Output Format

Output N lines, the number of new flowers after each plant grows.