One-dimensional Game

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Bogdan is playing a game. The game is one-dimensional --- there are nn platforms located on the horizontal line. Bogdan can move between platforms. The ii-th platform is a horizontal segment \[l_i,r_i]\[l\_i, r\_i]. All segments are distinct.

Let's say that the platform jj is inside the platform ii if l_il_jl\_i \le l\_j and r_jr_ir\_j \le r\_i.

At the beginning of the game, Bogdan chooses the platform from which he will start his journey. Moving between platforms is dangerous and Bogdan tries to stay away from the danger, so he can move from the platform ii to the platform jj only if the platform jj is inside the platform ii and there is no other platform kk, which is inside the platform ii and the platform jj is inside the platform kk.

For each platform Bogdan wants to know how many different paths he can take, starting from this platform and ending on any other. To paths are different if there is a platform, which is in the one of the paths but not in the other one.

Help Bogdan count the number of paths from each platform. Since the number of paths can be very large, find it modulo 109+710^9 + 7.

입력

The first line contains the only integer nn (1n31051 \le n \le 3 \cdot 10^5) --- the number of platforms.

The next nn lines contains the platforms' data, the ii-th of these lines contains two integers l_il\_i and r_ir\_i (1l_ir_i1091 \le l\_i \le r\_i \le 10^9) --- the ends of the ii-th segment of the platform.

출력

Print nn integers, the ii-th integer must be equal to the number of different paths from the platform ii, modulo 109+710^9 + 7.