print(*[_[0] for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2])))], sep='\n') _[0] for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2]))) for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2]))) _ sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2]))) sorted [[i+1] + input().split() for i in range(int(input()))] key=lambda x:(x[1], -int(x[2])) key lambda x:(x[1], -int(x[2])) (x[1], -int(x[2])) x[1] x 1 -int(x[2]) int(x[2]) int x[2] x 2 x for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2]))) _[0] _ 0 print(*[_[0] for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2])))], sep='\n') print *[_[0] for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2])))] [_[0] for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2])))] sep='\n' sep '\n'
print(*[_[0] for _ in sorted([[i+1] + input().split() for i in range(int(input()))], key=lambda x:(x[1], -int(x[2])))], sep='\n')
