Jim and the Orders

  • + 0 comments
    print(*(q[0]+1 for q in sorted([(i, sum(map(int, input().split()))) for i in range(int(input()))], key=lambda x: (x[1], x[0]))))