시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB476538.462%

문제

Artem has constructed a permutation $p$ of $n$ integers from $1$ to $n$ during the last Jinotega beer party. Kostya tried to guess it, but had no success. Then Artem gave some hints to Kostya: for each $i = 1, \ldots, n$, he told him two integers $l_i \le r_i$, meaning that element $i$ is situated between positions $l_i$ and $r_i$ inclusively. Kostya is sure that the lexicographically smallest permutation satisfying these conditions is the one Artem has constructed. As it is too late, and Kostya's brain is not working as well as usually after several glasses of beer, you need to help him.

입력

The first line of input contains a positive integer $n$ ($1 \le n \le 2 \cdot 10^5$), the length of the permutation.

Each of the next $n$ lines contain two integers $l_i$ and $r_i$ ($1 \le l_i \le r_i \le n$).

출력

If it is impossible to reconstruct the permutation, print a line containing the integer $-1$.

Otherwise, print a line containing $n$ space-separated integers $p_1, p_2, \ldots, p_n$: the desired permutation.

예제 입력 1

5
2 5
1 5
3 5
4 5
1 5

예제 출력 1

2 1 3 4 5

예제 입력 2

6
2 4
1 3
4 6
4 6
4 6
3 5

예제 출력 2

2 1 6 3 4 5

예제 입력 3

4
1 3
1 3
1 3
1 3

예제 출력 3

-1