CSES - Nested Ranges Count
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Given nn ranges, your task is to count for each range how many other ranges it contains and how many other ranges contain it.

Range [a,b][a,b] contains range [c,d][c,d] if aca \le c and dbd \le b.

Input

The first input line has an integer nn: the number of ranges.

After this, there are nn lines that describe the ranges. Each line has two integers xx and yy: the range is [x,y][x,y].

You may assume that no range appears more than once in the input.

Output

First print a line that describes for each range (in the input order) how many other ranges it contains.

Then print a line that describes for each range (in the input order) how many other ranges contain it.

Constraints

  • 1n21051 \le n \le 2 \cdot 10^5
  • 1x<y1091 \le x < y \le 10^9

Example

Input:

4
1 6
2 4
4 8
3 6

Output:

2 0 0 0
0 1 0 1