N = int(input())
T = [input().split() for _ in range(N)]
T = [(i, t[0], int(t[1])) for i, t in enumerate(T, 1)]

T.sort(key=lambda x: (x[1], -x[2]))
for t in T:
    print(t[0]) N = int(input()) N int(input()) int input() input input().split() for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) input().split() ().split () input split T = [input().split() for _ in range(N)] T [input().split() for _ in range(N)] (i, t[0], int(t[1])) for i, t in enumerate(T, 1) for i, t in enumerate(T, 1) i t enumerate(T, 1) enumerate T 1 for i, t in enumerate(T, 1) (i, t[0], int(t[1])) i t[0] t 0 int(t[1]) int t[1] t 1 T = [(i, t[0], int(t[1])) for i, t in enumerate(T, 1)] T [(i, t[0], int(t[1])) for i, t in enumerate(T, 1)] T.sort(key=lambda x: (x[1], -x[2])) T.sort T sort key=lambda x: (x[1], -x[2]) key lambda x: (x[1], -x[2]) (x[1], -x[2]) x[1] x 1 -x[2] x[2] x 2 x for t in T:
    print(t[0]) t T print(t[0]) print t[0] t 0 T = [input().split() for _ in range(N)] [input().split() for _ in range(N)] T N = int(input()) int(input()) N T = [(i, t[0], int(t[1])) for i, t in enumerate(T, 1)] [(i, t[0], int(t[1])) for i, t in enumerate(T, 1)] T
N = int(input())
T = [input().split() for _ in range(N)]
T = [(i, t[0], int(t[1])) for i, t in enumerate(T, 1)]

T.sort(key=lambda x: (x[1], -x[2]))
for t in T:
    print(t[0])
