시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB1000.000%

문제

We are given a regular polygon with n vertices. Let's choose m of its diagonals. We would like to know if there is such a pair of diagonals that intersect (having a common end-point does not count as intersection).

Write a program which:

  • reads a description of the polygon and selected diagonals from the standard input,
  • checks whether there is a pair of diagonals that intersect,
  • writes the result to the standard output.

입력

In the first line of the input there are two integers n and m (4 ≤ n ≤ 1 000 000, 2 ≤ m ≤ 10 000 000), separated with a single space and representing the number of vertices of the polygon and the number of selected diagonals. Following m lines contain descriptions of diagonals. Each line contains two integers ai and bi (1 ≤ ai, bin), separated with a single space and representing diagonal, which joins vertex number ai with vertex number bi (polygon's vertices are numbered with natural numbers from 1 to n in a counter-clockwise manner). You can assume that each pair of numbers defining a single diagonal defines a valid diagonal (not a single vertex or polygon's edge). All diagonals in the input will be different.

출력

The first and only line of the output should contain:

  • one word NIE (i.e. no in Polish), if there is no pair of diagonals that intersect, or
  • two different integers p and q (1 ≤ p, qm, pq), separated with a single space and representing numbers of diagonals that intersect. In case of multiple correct answers, your program can output any one of them. Diagonals are numbered in order of occurrence in the input.

예제 입력 1

6 4
3 6
1 4
6 2
2 5

예제 출력 1

2 3

예제 입력 2

6 2
1 3
1 5

예제 출력 2

NIE

힌트

In the image above, solid lines represent diagonals from the first input, while stroked lines represent diagonals from the second input.