403193: GYM101063 K Dire, Dire Docks

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Dire, Dire Dockstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Half a century after the Mars arrival by GEMA, we are finally here. The mission is finally starting to build artificial rivers on mars.

That is possibly the most important event on Mars since the GEMA arrival.

In order to carry on with it, the mission have mapped the surface as 2-dimensional plane, and has identified N points in it that are going to work as reference points to build a river system. There will be a dock constructed in each of these points to help on transportation efforts and collect data for the mission.

The goal of the mission is to connect all the docks with rivers. The lead researcher of the team responsible for that, doctor Maya Waters, has identified the main requirements to build a healthy river system. These are:

  • There are N docks. There should be a way to navigate between any two docks only through water;
  • The system must have exactly N rivers - no more, no less;
  • At most four rivers can meet at any single dock;
  • Any river should flow in a straight line between points A and B;
  • There should be no river crossings apart from the rivers meeting at docks. Note that a river passing through a dock counts as a crossing.

Help doctor Maya figure out which points to connect to build such river system and finally Make Mars Wet Again!

Input

Input begins with N (3 ≤ N ≤ 103), the number of points. Follows N lines, each with two integers xi, yi ( - 109 ≤ xi, yi ≤ 109), the coordinates of the pivotal points.

Output

Output N lines. In each line, output two integers , a and b - the indexes of the pivotal points that must be connected by a river. Indexing begins in 1. If there are multiple solutions, output any.

If it is an impossible task, output -1.

ExamplesInput
5
-1 0
2 3
3 2
5 4
6 1
Output
3 2
3 4
5 3
1 5
2 4
Input
3
0 0
1 2
3 6
Output
-1

Source/Category

加入题单

算法标签: