Triangles on the plane
Limits: 2 sec., 512 MiB
This statement was translated automatically from Ukrainian.
Given \(3 \cdot n\) points on the plane such that no three points lie on the same line. You need to construct \(n\) triangles such that the following conditions are met:
1. Each point is a vertex of only one triangle.
2. For any two triangles, the area of their intersection is \(0\).
It can be shown that under the problem constraints, this is always possible.
Input
The first line contains a single integer \(n\) — the number of triangles to be constructed.
Each of the next \(3 \cdot n\) lines contains two integers \(x_i\), \(y_i\) — the coordinates of the points.
Output
Output \(n\) lines, each containing three numbers — the indices of the points that form the corresponding triangle.
If there are several possible ways to form \(n\) triangles, output any of them.
Constraints
\(1 \leq n \leq 500\),
\(1 \leq x_i, y_i \leq 10^9\).
All points are guaranteed to be pairwise distinct.
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 1 3 1 1 3 4 3 2 4 6 5 4 | 1 2 4 3 5 6 |
Notes
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|