B. Layout (1000 points)

Rabbit has organized an elaborate peer-to-peer network in the forest with his friends-and-relations. Although by some magic the network works perfectly, it turned out to be incredibly intricate, and Rabbit decided to draw a huge Map to help him oversee maintenance operations. The Map should contain Nodes, and Edges between them as straight lines, in a way that no Edge intersects another one.

However hard he tried, Rabbit couldn't draw a proper Map - somehow some Edges always intersected. One of his relations then came up with a clever plan - what if it was allowed for an Edge to go out the side of the map and come in from the other side? (In the language of the forest, this was called a "Toroidal Map".) It turns out this makes it possible to draw the Map - but it's a new and unexpected task for Rabbit, and he asks You for help.

Input and Output

The Map will be drawn as 1000x1000 units big. Your output should look like this:

The Edges will be drawn as straight lines:

    N1X, N1Y -> N2X + SX*1000, N2Y + SY*1000

In short, SX and SY specify the "screen offset". Both SX and SY must be between -2 and +2 (inclusive). If SX and SY are 0, the Edge doesn't cross the side of the map. For example, if SX is -1 and SY is 0, then the Edge will start at N1, cross the left side of the map, come in from the right side and end at N2.

Neither Edges, nor any of their segments may intersect.

Example

For example, take this simple network (note that it's of course possible to draw this network on an ordinary Map):

4 2
0 2
1 3
If you lay out the Nodes in a counter-clockwise order, drawing both Edges locally will result in a bad solution:

300 300
700 300
700 700
300 700
0 0
0 0

This can be fixed by having one of the Edges cross the side of the Map:

300 300
700 300
700 700
300 700
0 0
1 0

Here is another bad solution, where the Edge segments don't intersect, but the Edges themselves do:

300 300
700 300
700 700
300 700
-1 0
1 0