f | def acmp(a, b): | f | def acmp(a, b): |
| return (a[0] == b[0] and a[1] == b[1] and (a[2] == b[2])) - (a[0] <= | | return (a[0] == b[0] and a[1] == b[1] and (a[2] == b[2])) - (a[0] <= |
| b[0] and a[1] <= b[1] and (a[2] <= b[2])) | | b[0] and a[1] <= b[1] and (a[2] <= b[2])) |
| seq = [] | | seq = [] |
| while (s := input()): | | while (s := input()): |
| seq.append(eval(s)) | | seq.append(eval(s)) |
| res = [] | | res = [] |
| while seq: | | while seq: |
n | for n, a in enumerate(seq): | n | for f, a in enumerate(seq): |
| if all((not acmp(sorted(a), sorted(b)) for b in seq)): | | if all((not acmp(sorted(a), sorted(b)) for b in seq)): |
t | res.append(seq.pop(n)) | t | res.append(seq.pop(f)) |
| break | | break |
| for el in res: | | for el in res: |
| print(*el, sep=', ') | | print(*el, sep=', ') |