You are given , where is even, points on a plane that have integer coordinates. For each integer , there are at most two points with coordinates . Analogously, for each integer , there are at most two points with coordinates .
You are able to draw horizontal or vertical line segments between pairs of given points. Is it possible to draw lines such that each of the given points is an endpoint of exactly one line segment and that no two line segments intersect?
Input
The first line contains an even integer from the task description. The -th of the next lines contains two integers , coordinates of the -th point.
Output
If it is not possible to draw the line segments as explained in the task statement, you should output NE
(NO in Croatian) in a single line.
Otherwise, you should output DA
(YES in Croatian) in the first line. In each of the next lines you should output two space-separated integers and , which represent indices of the points that are connected with a drawn line segment.
Scoring
Subtask | Score | Constraints |
---|---|---|
, for each integer , there is an even number of points with coordinates and an even number of points with coordinates | ||
No additional constraints. |
Sample Input 1
8
1 1
1 3
2 2
2 4
3 1
3 3
4 2
4 4
Sample Output 1
DA
1 5
3 7
2 6
4 8
Sample Input 2
6
1 2
1 3
2 1
2 4
3 2
3 3
Sample Output 2
DA
1 2
3 4
5 6
Sample Input 3
2
1 1
2 2
Sample Output 3
NE
Comments