def distance(x1, y1, x2, y2):
"""Calculates the Euclidean distance between two points."""
return ((x2 - x1)**2 + (y2 - y1)**2)**0.5
def calculate_stability(points):
"""Calculates the stability of a triumvirate."""
distances = []
for i in range(3):
for j in range(i + 1, 3):
distances.append(distance(points[i][0], points[i][1], points[j][0], points[j][1]))
return max(distances) - min(distances)
def find_best_triumvirates(points):
"""Finds the best grouping of points into triumvirates."""
n = len(points)
triumvirates = []
for i in range(0, n, 3):
triumvirates.append([i, i + 1, i + 2])
best_triumvirates = triumvirates
best_score = sum(calculate_stability([points[j] for j in t]) for t in triumvirates)
# Implement a more efficient search algorithm here to find the optimal grouping
# (e.g., brute force, greedy, or a more advanced optimization technique)
return best_triumvirates
def main():
n = int(input())
points = []
for _ in range(n):
x, y = map(int, input().split())
points.append((x, y))
best_triumvirates = find_best_triumvirates(points)
for t in best_triumvirates:
print(*t)
if __name__ == "__main__":
main()
ZGVmIGRpc3RhbmNlKHgxLCB5MSwgeDIsIHkyKToKICAiIiJDYWxjdWxhdGVzIHRoZSBFdWNsaWRlYW4gZGlzdGFuY2UgYmV0d2VlbiB0d28gcG9pbnRzLiIiIgogIHJldHVybiAoKHgyIC0geDEpKioyICsgKHkyIC0geTEpKioyKSoqMC41CgpkZWYgY2FsY3VsYXRlX3N0YWJpbGl0eShwb2ludHMpOgogICIiIkNhbGN1bGF0ZXMgdGhlIHN0YWJpbGl0eSBvZiBhIHRyaXVtdmlyYXRlLiIiIgogIGRpc3RhbmNlcyA9IFtdCiAgZm9yIGkgaW4gcmFuZ2UoMyk6CiAgICBmb3IgaiBpbiByYW5nZShpICsgMSwgMyk6CiAgICAgIGRpc3RhbmNlcy5hcHBlbmQoZGlzdGFuY2UocG9pbnRzW2ldWzBdLCBwb2ludHNbaV1bMV0sIHBvaW50c1tqXVswXSwgcG9pbnRzW2pdWzFdKSkKICByZXR1cm4gbWF4KGRpc3RhbmNlcykgLSBtaW4oZGlzdGFuY2VzKQoKZGVmIGZpbmRfYmVzdF90cml1bXZp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