with open("kik.txt") as file:
points = [list(map(float, str.split(" "))) for str in file.read().split("\n")]
points = points[:100]
points = [[int(point[0] * 1000), int(point[1] * 1000)] for point in points]
for i in range(len(points)):
for j in range(1, len(points) - i):
x1 = points[j][0]
y1 = points[j][1]
x2 = points[j - 1][0]
y2 = points[j - 1][1]
if x1 < x2 or (x1 == x2 and y1 < y2):
points[j - 1][0], points[j][0] = points[j][0], points[j - 1][0]
points[j - 1][1], points[j][1] = points[j][1], points[j - 1][1]
with open("kik_posortowane.txt", "w") as out_file:
for point in points:
print(point[0], point[1], file=out_file)