| t | data = [] | t | data = [] |
| while True: | | while True: |
| line = input().strip() | | line = input().strip() |
| if not line or ' ' not in line: | | if not line or ' ' not in line: |
| break | | break |
| x, y, z, name = line.split() | | x, y, z, name = line.split() |
| data.append((float(x), float(y), float(z), name)) | | data.append((float(x), float(y), float(z), name)) |
| pairs = [(data[i], data[j]) for i in range(len(data)) for j in range(i + | | pairs = [(data[i], data[j]) for i in range(len(data)) for j in range(i + |
| 1, len(data))] | | 1, len(data))] |
| | | |
| def sq_distance(p1, p2): | | def sq_distance(p1, p2): |
| return (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2 + (p1[2] - p2[2]) | | return (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2 + (p1[2] - p2[2]) |
| ** 2 | | ** 2 |
| gal1, gal2 = max(pairs, key=lambda p: sq_distance(p[0], p[1])) | | gal1, gal2 = max(pairs, key=lambda p: sq_distance(p[0], p[1])) |
| names = sorted([gal1[3], gal2[3]]) | | names = sorted([gal1[3], gal2[3]]) |
| print(names[0], names[1]) | | print(names[0], names[1]) |