"""The baseline: nearest neighbour. Reads the points as JSON on stdin and prints the tour as JSON.""" import json import math import sys p = json.load(sys.stdin) left, tour = set(range(1, len(p))), [0] while left: nxt = min(left, key=lambda j: math.dist(p[tour[-1]], p[j])) left.remove(nxt) tour.append(nxt) print(json.dumps(tour))