You have decided to write a book introducing good restaurants.
There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.
No two restaurants have the same score.
You want to introduce the restaurants in the following order:
 - The restaurants are arranged in lexicographical order of the names of their cities.
 - If there are multiple restaurants in the same city, they are arranged in descending order of score.
Print the identification numbers of the restaurants in the order they are introduced in the book.

-----Constraints-----
 - 1 ≤ N ≤ 100
 - S is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.
 - 0 ≤ P_i ≤ 100
 - P_i is an integer.
 - P_i ≠ P_j (1 ≤ i < j ≤ N)

-----Input-----
Input is given from Standard Input in the following format:
N
S_1 P_1
:
S_N P_N

-----Output-----
Print N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.

-----Sample Input-----
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40

-----Sample Output-----
3
4
6
1
5
2

The lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.
[{"code": "n=int(input())\na=[]\nfor i in range(n):\n  t=list(input().split())\n  t[1]=int(t[1])\n  t.append(i)\n  a.append(t)\na.sort(key=lambda x:(x[0],-x[1]))\nfor t in a:\n  print(t[2]+1)", "passed": true, "time": 0.2, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\nsp =[[] for _ in range(n)]\nfor i in range(n):\n    sp[i] = list(input().split())\n    sp[i].append(i+1)\n\nssp = sorted(sp, key=lambda x:(x[0],-int(x[1])))\nfor i in range(n):\n    print(ssp[i][2])", "passed": true, "time": 0.15, "memory": 14232.0, "status": "done"}, {"code": "import re\nn = int(input())\nR = []\nfor i in range(n):\n    S, P = input().split()\n    R.append((S, int(P),int(i+1)))\n\nPoint = []\nfor j in range(n):\n    Point.append(R[j][0])\nPoint = list(sorted(set(Point)))\nPoint\nSR = sorted(R, key=lambda x:(x[0], -int(x[1])))\nfor k in range(n):\n    print(SR[k][2])\npass", "passed": true, "time": 0.25, "memory": 14216.0, "status": "done"}, {"code": "N = int(input())\nl = []\nfor i in range(N):\n    s,p = input().split()\n    l.append([s,int(p),i+1])\n\nl = sorted(l,key = lambda x:x[1],reverse=True)\nl = sorted(l,key = lambda x:x[0])\n\nfor i in range(N):\n    print(l[i][2])", "passed": true, "time": 0.92, "memory": 14316.0, "status": "done"}, {"code": "n=int(input())\n\nsp=[]\nfor i in range(n):\n  s,p=input().split()\n  sp.append([s,int(p),i+1])\n\nsp=sorted(sp,key=lambda x:(x[0],-x[1]))\n\nfor i in range(n):\n  print(sp[i][2])", "passed": true, "time": 0.26, "memory": 14328.0, "status": "done"}, {"code": "from operator import itemgetter\nn=int(input())\nSP=[list(map(str,input().split())) for i in range(n)]\nfor sp in SP:\n  sp[1] = -1*int(sp[1])\nSPsort = sorted(SP,key=itemgetter(0,1))\nfor i in range(n):\n  print(SP.index(SPsort[i])+1)", "passed": true, "time": 0.25, "memory": 14268.0, "status": "done"}, {"code": "N = int(input())\n\nl = []\n\nfor i in range(N):\n    s, p = input().split()\n    \n    l.append([i + 1, s, int(p)])\n    \nl = sorted(l, key=lambda x: x[2], reverse=True)\nl = sorted(l, key=lambda x: x[1])\n\nfor x in l:\n    print(x[0])", "passed": true, "time": 0.19, "memory": 14116.0, "status": "done"}, {"code": "\nN = int(input())\n\nd = []\nfor i in range(N):\n    city, score = input().split()\n    d.append({'city':city,'score':int(score),'index':i+1})\n\n\nsorted_d = sorted(d, key=lambda x:x['city'])\n\nunique_city = []\n\nfor i in sorted_d:\n    if i['city'] not in unique_city:\n        unique_city.append(i['city'])\n\nfor city in unique_city:\n    pool = [x for x in sorted_d if x['city']==city]\n    sorted_pool = sorted(pool, key=lambda x:x['score'], reverse=True)\n    for i in sorted_pool:\n        print((i['index']))\n", "passed": true, "time": 0.26, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\na = [list(input().split(\" \")) for i in range(n)]\nb = []\nfor i in a:\n  b.append([i[0], 1000-int(i[1])])\nc = sorted(b)\n\n#print(b, c)\nfor i in c:\n  print(b.index(i)+1)", "passed": true, "time": 0.23, "memory": 14212.0, "status": "done"}, {"code": "N = int(input())\nSP = [list(input().split()) for _ in range(N)]\n\nfor i in range(N):\n    SP[i].append(i+1)\n  \nans = sorted(SP, key=lambda x:(x[0], -int(x[1])))\n\n#for i in range(N):\n#    print(ans[i][2])\n\nfor i in ans:\n    print(i[2])", "passed": true, "time": 0.17, "memory": 14052.0, "status": "done"}, {"code": "n=int(input())\nd=[]\nans=[0]*n\nfor i in range(n):\n  s,p = input().split()\n  p = -int(p)\n  d.append([i+1,s,p])\nd2 = sorted(d, key=lambda x:(x[1], x[2]))\nfor i in range(n):\n  print(d2[i][0])", "passed": true, "time": 0.23, "memory": 14328.0, "status": "done"}, {"code": "n = int(input())\n\ns = []\n\nfor i in range(n):\n\ts.append((input()+' '+str(i)).split())\n\nfor i in range(n):\n\ts[i][1] = int(s[i][1])\n    \ns.sort(key=lambda x:x[1], reverse=True)\ns.sort(key=lambda x:x[0])\n\nfor i in s:\n\tprint(int(i[2])+1)", "passed": true, "time": 0.22, "memory": 14240.0, "status": "done"}, {"code": "n=int(input())\ns=[]\nfor i in range(n):\n    tmp=input().split()\n    tmp[1]=100-int(tmp[1])\n    s.append(tmp+[str(i+1)])\ns=sorted(s)\n\nfor i in range(n):\n    print((s[i][-1]))\n", "passed": true, "time": 0.23, "memory": 14268.0, "status": "done"}, {"code": "N = int(input())\nSP = []\nidx = 1\n\nfor _ in range(N):\n\tS, P = input().split()\n\tSP.append([idx, S, int(P)])\n\tidx += 1\n\nSP.sort(key = lambda x:(x[1], -x[2]))\n\nfor i in range(N):\n\tprint(SP[i][0])", "passed": true, "time": 0.14, "memory": 14248.0, "status": "done"}, {"code": "n = int(input())\nr = []\nfor i in range(n):\n    a = list(input().split())\n    a[1] = int(a[1])\n    a.append(i + 1)\n    r.append(a)\nr.sort(key = lambda x: x[1], reverse = True)\nr.sort(key = lambda x: x[0])\nfor i in r:\n    print(i[2])", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "n = int(input())\na = sorted([input().split() + [i+1] for i in range(n)], key=lambda x:(x[0], -int(x[1])))\nfor n, s, i in a:\n  print(i)\n", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "N = int(input())\nlst = []\nfor _ in range(N):\n    S, P = input().split()\n    lst.append([S, int(P)])\ndct = dict(enumerate(lst))\nlst2 = sorted(lst)\n\ndct2 = {}\nfor n in lst2:\n    if not n[0] in dct2:\n        dct2[n[0]] = []\n        dct2[n[0]].append(n[1])\n    else:\n        dct2[n[0]].append(n[1])\n\nfor m in dct2.keys():\n    dct2[m] = sorted(dct2[m], reverse=True)\n    \nlst3 = []\nfor x in dct2.keys():\n    for y in dct2[x]:\n        lst3.append([x, y])\n\nfor i in lst3:\n    for k, v in dct.items():\n        if i == v:\n            print(k+1)", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "N = int(input())\nRest = dict()\nParg = [0]*(101)\nfor i in range(N):\n    S, P = map(str,input().split())\n    P = int(P)\n    if S not in Rest:\n        Rest[S] = [P]\n    else:\n        Rest[S] += [P]\n    Parg[P] = i+1 \nRestsort = sorted(Rest)\nfor cit in Restsort:\n    box = Rest[cit]\n    box.sort(reverse = True)\n    for j in box:\n        print(Parg[j])", "passed": true, "time": 0.17, "memory": 14328.0, "status": "done"}, {"code": "n = int(input())\ns_p = [ list(map(str, input().split())) for i in range(n)  ]\n\nd = {}\nfor i, v in enumerate(s_p):\n    s = v[0]\n    p = v[1]\n    if s not in d.keys():\n        d[s] = [(i, p)]\n    else:\n        d[s] = sorted(d[s] + [(i,p)], key=lambda x: int(x[1]), reverse=True)\n\nfor key in sorted(d.keys()):\n    for i,j in d[key]:\n        print(i+1)", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "N = int(input())\n\nmy_list = []\n\nfor i in range(N):\n    sp = input().split()\n    sp[1] = int(sp[1])\n    sp.insert(0, i+1)\n    \n    my_list.append(sp)\n    \nmy_list.sort(key = lambda x: x[2], reverse=True)\nmy_list.sort(key = lambda x: x[1])\n\nfor i in my_list:\n    print(i[0])", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "from operator import itemgetter \nn = int(input())\npoint = []\nans = []\nfor i in range(n):\n    a,b = input().split()\n    s = [a,int(b),i+1]\n    point.append(s)\n\ns_point = sorted(point,key=itemgetter(1),reverse=True)\ns_point = sorted(s_point,key=itemgetter(0))\n[print(s_point[j][2]) for j in range(n)]", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "n = int(input())\nc = []\nfor i in range(n):\n  a, b = input().split()\n  c.append([i+1, a, -int(b)])\n\nc = sorted(c, key=lambda x: (x[1], x[2]))\nfor i in c:\n  print(i[0])", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "n = int(input())\nsp = list([input().split() for i in range(n)])\nsp2 =[[i] + sp[i] for i in range(n)]\n\nans = sorted(sp2, key= lambda x:int(x[2]), reverse=True)\n\nans2 = sorted(ans, key =lambda x:x[1])\nfor i in range(n):\n  \n  print(ans2[i][0] +1)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "n = int(input())\ntbl = []\n\nfor i in range(n):\n    l = list(map(str,input().split()))\n    l[1] = int(l[1])\n    l2 = [l[1], l[0], i + 1]\n    tbl.append(l2)\n\ntbl.sort(key = lambda x:(x[1], -x[0]))\nfor i in range(n):\n    print((tbl[i][2]))\n", "passed": true, "time": 0.14, "memory": 14384.0, "status": "done"}, {"code": "N=int(input())\n\nguide=[]\n\nfor i in range(N):\n    name,score=map(str,input().split())\n    guide.append([i,name,int(score)])\n\nguide_sorted=sorted(guide,reverse=True,key=lambda x:x[2])\nguide_sorted=sorted(guide_sorted,key=lambda x:x[1])\n\nfor i in range(N):\n    print(guide_sorted[i][0]+1)", "passed": true, "time": 0.16, "memory": 14296.0, "status": "done"}, {"code": "n= int(input())\nx = [input().split() for i in range(n)]\nfor i in range(n):\n    x[i].append(i+1)\ny= sorted(x,key= lambda i:(i[0],-int(i[1])))\nfor i in range(n):\n    print(y[i][2])", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "n = int(input())\ncity = []\nl = []\nfor i in range(n):\n  s,p = input().split()\n  if s not in city: city.append(s)\n  l.append((s, int(p), i+1))\n  \ncity = sorted(set(city))\nl = sorted(l, key=lambda x: x[1], reverse=True)\nfor i in city:\n  for j in l:\n    if i == j[0]: print(j[2])", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "n=int(input())\nsp=[]\nfor i in range(n):\n  s,p=input().split()\n  sp.append([s,int(p),i+1])\n  \nsp=sorted(sp,key=lambda x:(x[0],-x[1]))\n\nfor i in range(n):\n  print(sp[i][2])", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "N=int(input())\nSP=[[input().split(),i+1] for i in range(N)]\nSP_sort=sorted(SP,key=lambda x:(x[0][0],-int(x[0][1])))\n\nfor i in range(N):\n  print((SP_sort[i][1]))\n", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "n = int(input())\na = [input().split() for i in range(n)]\nfor i in range(n):\n    a[i][1] = int(a[i][1])\n    a[i].append(i + 1)\na.sort()\nfor i in range(100):\n    for j in range(1,n):\n        if a[j][0] == a[j-1][0] and a[j][1] > a[j-1][1]:\n            a[j-1],a[j] = a[j],a[j-1]\nfor i in range(n):\n    print(a[i][2])", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "N = int(input())\nSP = []\nfor i in range(N):\n    s, p = input().split()\n    p = int(p)\n    SP.append((s,p,i+1))\n\nSP.sort(key=lambda x: (x[0], -x[1]))\nfor i in range(N):\n    print((SP[i][2]))\n", "passed": true, "time": 0.16, "memory": 14088.0, "status": "done"}, {"code": "def solver():\n    N = int(input())\n    ans = []\n    for i in range(1, N+1):\n        s, p = [n for n in input().split()]\n        ans.append({'id': i, 'city': s , 'point': int(p)})\n    ans_s = sorted(ans, key=lambda x: (x['city'], -x['point']))\n    for j in ans_s:\n        print((j['id']))\n\ndef __starting_point():\n    solver()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14280.0, "status": "done"}, {"code": "n = int(input())\n\nlst = []\nfor i in range(1, n + 1):\n    s, p = input().split()\n    lst.append([i, s, -int(p)])\nlst.sort(key=lambda x: (x[1], x[2]))\nfor i in lst:\n    print(i[0])", "passed": true, "time": 0.14, "memory": 14328.0, "status": "done"}, {"code": "N = int(input())\nbook = []\nfor i in range(N):\n    city, sco = input().split()\n    sco = int(sco)\n    book.append({'city':city, 'score':sco, 'number':i+1})\n\nbook.sort(key = lambda x: (x['city'],-x['score']))\n\nfor j in range(N):\n    print((book[j]['number']))\n", "passed": true, "time": 0.17, "memory": 14084.0, "status": "done"}, {"code": "#import bisect,collections,copy,heapq,itertools,math,numpy,string\nimport sys\n\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\ndef S(): return sys.stdin.readline().rstrip()\ndef LS(): return list(sys.stdin.readline().rstrip().split())\n\nN = int(input())\nSPs = [list(map(str, input().split())) for _ in range(N)]\n\ntmp = 1\nfor SP in SPs:\n    \n    SP[1] = int(SP[1])\n    SP.append(tmp)\n    tmp += 1\n\nSPs = sorted(SPs, key=lambda x:(x[0],-x[1]), reverse=False)\n\nfor ans in SPs:\n    print(ans[2])", "passed": true, "time": 0.15, "memory": 14344.0, "status": "done"}, {"code": "N = int(input())\nbook = []\nfor i in range(1, N+1):\n  city, point = input().split()\n  point = int(point)\n  book.append(((city, -point), i))\nbook.sort()\n\nfor info in book:\n  print(info[1])", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "n = int(input())\nsp = [input().split() for i in range(n)]\n\nfor i in range(n) :\n    sp[i][1] = int(sp[i][1])\n    sp[i].append(i+1)\n\nsp.sort()\n\nfor i in range(100):\n    for j in range(1,n) :\n        if sp[j][0] == sp[j-1][0] :\n            if sp[j][1] > sp[j-1][1] :\n                sp[j-1],sp[j] = sp[j],sp[j-1]\n\nfor i in range(n):\n    print((sp[i][2]))\n", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\nsp = [list(map(str,input().split())) for i in range(n)]\nfor i in range(1,n+1):\n  sp[i-1][1] = int(sp[i-1][1])\n  sp[i-1].append(i)\nfrom operator import itemgetter\nsp.sort(key = itemgetter(1),reverse = True)\nsp.sort(key = itemgetter(0))\nfor i in range(n):\n  print(sp[i][2])", "passed": true, "time": 0.16, "memory": 14240.0, "status": "done"}, {"code": "n = int(input())\nlst = []\nfor i in range(n):\n    s, p = input().split()\n    lst.append([s, -(int(p)), i+1])\nlst.sort()\nfor i in range(n):\n    print((lst[i][2]))\n", "passed": true, "time": 0.3, "memory": 14368.0, "status": "done"}, {"code": "n = int(input())\n\nrest = []\n\nfor x in range(n):\n  a,b = input().split()\n  b = int(b)\n  rest.append([a,b])\n  \n  \nrest2 = list(sorted(rest, key=lambda x:(x[1]), reverse=True))\nrest3 = list(sorted(rest2,key=lambda x:x[0]))\n\nfor i in rest3:\n  print((rest.index(i)+1))\n", "passed": true, "time": 0.21, "memory": 14140.0, "status": "done"}, {"code": "N = int(input())\nr_list = []\nfor i in range(N):\n  item = input().split()\n  item[1] = int(item[1])\n  item.insert(0, i + 1)\n  r_list.append(item)\n\nr_list.sort(key = lambda x: x[2], reverse = True)\nr_list.sort(key = lambda x: x[1])\nfor item in r_list:\n  print(item[0])", "passed": true, "time": 0.14, "memory": 14336.0, "status": "done"}, {"code": "n = int(input())\nx = [input().split() for i in range(n)]\nfor i in range(n):\n    x[i][1] = int(x[i][1])\n    x[i].append(i+1)\n\nx.sort(key= lambda a: a[1])\nx.reverse()\nx.sort(key= lambda b: b[0])\n\nfor i in range(n):\n    print(x[i][2])", "passed": true, "time": 0.21, "memory": 14312.0, "status": "done"}, {"code": "n=int(input())\nsp=[list(input().split()) for _ in range(n)]\nfor i in sp:\n    i[1]=100-int(i[1])\nfor i in range(n):\n    sp[i].append(i+1)\nsp.sort()\nfor i in sp:\n    print((i[2]))\n", "passed": true, "time": 0.26, "memory": 14324.0, "status": "done"}, {"code": "N = int(input())\nrestaurants = []\nfor i in range(N):\n    name, rating = input().split()\n    restaurants.append([name, -int(rating), i])\nrestaurants.sort()\nfor i in restaurants:\n    print((i[2] + 1))\n", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "N = int(input())\nSP = []\nfor i in range(N):\n    S, P = input().split()\n    SP.append([i+1, S, int(P)])\n\nsort_SP = sorted(SP, key = lambda x: (x[1], -x[2]))\n\nfor ans in sort_SP:\n    print((ans[0]))\n\n", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "from  operator import itemgetter\nN = int(input())\nl = []\ns = []\nfor i in range(1, N+1):\n  k, v = input().split()\n  l.append([k, int(v), i])\n  s.append(k)\nl = sorted(l)\ns = sorted(list(set(s)))\n\nfor t in s:\n  for n in range(N-1, -1, -1):\n    k, v, i = l[n]\n    if t == k:\n      print(i)\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "\nurl = \"https://atcoder.jp//contests/abc128/tasks/abc128_b\"\n\ndef main():\n    n = int(input())\n    town = {}\n    rate = []\n    for i in range(n):\n        t = list(input().split())\n        town.setdefault(t[0], {})\n        town[t[0]][i+1] = int(t[1])\n    town = sorted(list(town.items()), key=lambda x:x[0])\n    for k in town:\n        sort_town = sorted(list(k[1].items()), key=lambda x:x[1], reverse=True)\n        for v in sort_town:\n            print((v[0]))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "N = int(input())\nX = [[input().split(), i + 1] for i in range(N)]\n\nX = sorted(X , key = lambda x:(x[0][0], -int(x[0][1])))\n\nfor i in range(N):\n  print(X[i][1])", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "n=int(input())\ndata=[]\nfor i in range(n):\n    s,p=input().split()\n    tmp=[s,-int(p),i+1]\n    data.append(tmp)\ndata.sort()\nfor i in range(n):\n    print(data[i][2])", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "from operator import itemgetter\n\nN = int(input())\nrestaurants = []\n\nfor i in range(N):\n    arr = input().split()\n    restaurants.append((i + 1, arr[0], -int(arr[1])))\n\nrestaurants = sorted(restaurants, key=itemgetter(1, 2))\n\nfor i in range(N):\n    print(restaurants[i][0])", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "N = int(input())\ncity = []\nscore = dict()\narr = []\nfor i in range(N):\n  c, s = input().split()\n  arr.append([c, int(s)])\n  city.append(c)\n  if c in score:\n    score[c].append(int(s))\n  else:\n    score[c] = [int(s)]\ncity.sort()\nans = []\nfor i, var in enumerate(city):\n  t = score[var].index(max(score[var]))\n  u = score[var].pop(t)\n  ans.append(arr.index([var,u]) + 1)\nfor i in ans:\n  print(i)", "passed": true, "time": 0.14, "memory": 14396.0, "status": "done"}, {"code": "N=int(input())\nSP=sorted([list(input().split())+[_+1] for _ in range(N)])\ntempcity=SP[0][0]\nans=[]\ntempans=[]\nfor i in range(N):\n\t#print(tempans)\n\tif tempcity == SP[i][0]:\n\t\ttempans.append([int(SP[i][1]),SP[i][2]])\n\telse:\n\t\ttempans=sorted(tempans, reverse=True)\n\t\tfor h in range(len(tempans)):\n\t\t\tans.append(tempans[h][1])\n\t\ttempans=[]\n\t\ttempcity=SP[i][0]\n\t\ttempans.append([int(SP[i][1]),SP[i][2]])\n\tif i==N-1:\n\t\ttempans=sorted(tempans, reverse=True)\n\t\tfor h in range(len(tempans)):\n\t\t\tans.append(tempans[h][1])\n\t\t\nfor g in range(N):print(ans[g])", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "N=int(input())\nx=[]\nfor i in range(N):\n    S,P=map(str,input().split())\n    x.append([S,int(P),i+1])\nX=sorted(x,key=lambda x:(x[0],-x[1]))\nfor i in range(N):\n    print(X[i][2])", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "N = int(input())\nS = []\nP = []\nfor i in range(N):\n    s,p = input().split()\n    S.append(s)\n    P.append(int(p))\nSset = sorted(list(set(S)))\n\ndict1 = {}\nfor i in range(N):\n    dict1[P[i]] = S[i]\n\nfor k in Sset:\n    U = [i for i, j in dict1.items() if j == k]\n    V = sorted(U,reverse=True)\n    for l in V:\n        print(P.index(l) + 1)", "passed": true, "time": 0.14, "memory": 14016.0, "status": "done"}, {"code": "n = int(input())\nsp = []\nfor i in range(n):\n    s, p = input().split()\n    p = int(p)\n    sp.append((i+1, s, p))\n\nl = sorted(sp, key=lambda x: (x[1], -x[2]))\nfor a, b, c in l:\n    print(a)", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "n=int(input())\nl=[]\nfor i in range(n):\n  city,point=input().split()\n  point=int(point)\n  l.append((city,-point,i+1))\n\nfor c,p,i in sorted(l):\n  print(i)", "passed": true, "time": 0.14, "memory": 13952.0, "status": "done"}, {"code": "N = int(input())\nl = []\nfor i in range(N):\n  s, p = input().split()\n  l.append([s, -int(p), i+1])\n\n# \u5730\u540d\u306b\u95a2\u3057\u3066\u8f9e\u66f8\u9806\u306b / (-\u70b9\u6570)\u306b\u95a2\u3057\u3066\u6607\u9806\u306b\uff08\u70b9\u6570\u306b\u95a2\u3057\u3066\u964d\u9806\u306b\uff09\u4e26\u3079\u308b\nl = sorted(l, key=lambda x:(x[0], x[1]))\nfor i in range(N):\n  print(l[i][2])", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "n = int(input())\ndata = [input().split() for i in range(n)]\nfor i in range(n):\n    data[i].append(i + 1)\n    if 10 <=int(data[i][1]) < 100:\n        data[i][1] = '0' + str(data[i][1])\n    elif int(data[i][1]) < 10:\n        data[i][1] = '00' + str(data[i][1])\ndata.sort(key = lambda x :x[1],reverse = True)\ndata.sort(key = lambda x :x[0])\nfor i in range(n):\n    print(data[i][2])", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "from typing import List, Tuple\n\n\ndef answer(n: int, sps: List[Tuple[str, int]]) -> List[int]:\n    result = []\n    numbered_sps = []\n    for i, sp in enumerate(sps, start=1):\n        s, p = sp\n        numbered_sps.append([i, s, p])\n    numbered_sps = sorted(numbered_sps, key=lambda x: (x[1], -x[2]))\n    for i in numbered_sps:\n        result.append(i[0])\n\n    return result\n\n\ndef main():\n    n = int(input())\n    temp = (input().split() for _ in range(n))\n    sps = []\n    for s, p in temp:\n        sps.append((s, int(p)))\n    for i in answer(n, sps):\n        print(i)\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 15648.0, "status": "done"}, {"code": "N=int(input())\nd=[input().split() for i in range(N)]\nname=[]\nfor i in range(N):\n    d[i].append(i+1)\n    d[i][1]=int(d[i][1])\n    name.append(d[i][0])\nName=list(set(name))\nName.sort()\nd.sort()\nfor i in range(len(Name)):\n    li=[]\n    for j in range(N):\n        if Name[i]==d[j][0]:\n            li.append([d[j][1],d[j][2]])\n        else:\n            continue\n    li.sort()\n    Li=li[::-1]\n    for k in range(len(li)):\n        print(Li[k][1])", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "n=int(input())\n\ns_list=[]\n\nfor i in range(n):\n    s,p=input().split()\n    p=int(p)*(-1)\n    s_list.append([s,p,i+1])\n#print(s_list)\ns_list.sort()\n#print(s_list)\n\nfor i in s_list:\n    print((i[2]))\n\n", "passed": true, "time": 0.15, "memory": 14112.0, "status": "done"}, {"code": "def mapt(fn, *args):\n    return list(map(fn, *args))\n\n\ndef Atom(segment):\n    try:\n        return int(segment)\n    except ValueError:\n        try:\n            float(segment)\n        except ValueError:\n            return segment\n\n\ndef Input():\n    return mapt(int, input().split(\" \"))\n\n\ndef main():\n    n = int(input())\n    data = [mapt(Atom, input().split(\" \")) for _ in range(n)]\n    for i in range(n):\n        data[i].append(i)\n    data = sorted(data, key=lambda x:x[1], reverse=True)\n    data = sorted(data, key = lambda x:x[0])\n    for row in data:\n        print(row[2]+1)\n\nmain()", "passed": true, "time": 0.15, "memory": 14388.0, "status": "done"}, {"code": "n = int(input())\nd =[]\nfor i in range(n):\n    s,p = input().split()\n    l = [s,-int(p),i+1]\n    d.append(l)\nd.sort()\nfor x in d:\n    print(x[2])", "passed": true, "time": 0.15, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\na = []\nfor i in range(n):\n    s, p = input().split()\n    p = int(p)\n    a.append([s, -p, i])\na.sort()\n\nfor i in a:\n    print((i[2] + 1))\n", "passed": true, "time": 0.15, "memory": 14316.0, "status": "done"}, {"code": "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')\n", "passed": true, "time": 0.18, "memory": 14296.0, "status": "done"}, {"code": "N=int(input())\nshop=[]\nfor i in range(N):\n    S,P=input().split()\n    P=int(P)\n    shop.append([S,100-P,i])\nshop.sort()\nfor i in range(N):\n    print((shop[i][2]+1))\n", "passed": true, "time": 0.15, "memory": 14252.0, "status": "done"}, {"code": "import sys\n\ndef main():\n    input = sys.stdin.readline\n    N = int(input())\n    restaurants = []\n    for _ in range(N):\n        s, p = input().split()\n        restaurants.append((s.strip(), int(p)))\n\n    rank = sorted(restaurants, key=lambda x: (x[0], -x[1]))\n    for a in rank:\n        print(int(restaurants.index(a)) + 1)\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "l=int(input())\nL=[]\nfor i in range(l):\n    n,k=map(str,input().split())\n    c=[]\n    c.append(n)\n    c.append(100-int(k))\n    c.append(i+1)\n    L.append(c)\nL.sort()\nfor i in range(l):\n    print(L[i][2])", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "n = int(input())\nlist_res = []\nfor i in range(0, n):\n    s, p = input().split()\n    list_res.append([s, int(p), i + 1])\nlist_res_point = sorted(list_res, key=lambda x: (x[1]), reverse=True)\nlist_ans = sorted(list_res_point, key=lambda x: (x[0]))\nfor i in range(0, n):\n    print(list_ans[i][2])", "passed": true, "time": 0.15, "memory": 14308.0, "status": "done"}, {"code": "n=int(input())\nrec=[]\nfor i in range(n):\n    a,b=input().split()\n    rec.append([a,int(b),i+1])\nrec=sorted(rec, reverse=True, key=lambda x: x[1]) \nrec=sorted(rec, key=lambda x: x[0]) \nfor i in rec:\n    print(i[2])", "passed": true, "time": 0.21, "memory": 14104.0, "status": "done"}, {"code": "N = int(input())\nR = [input().split() for i in range(N)]\n\nR2 = [{'i':i+1, 's':R[i][0], 'p':int(R[i][1])} for i in range(N)] \n\nS = []\nfor r in R:\n  if r[0] not in S:\n    S.append(r[0])\nS.sort()\n\nfor s in S:\n  rs = [r for r in R2 if r['s'] == s]\n  sorted_rs = sorted(rs, key=lambda x:x['p'], reverse=True)\n  for r in sorted_rs:\n    print(r['i'])", "passed": true, "time": 0.24, "memory": 14072.0, "status": "done"}, {"code": "n = int(input())\nL = []\n\nfor i in range(n):\n    s, p = input().split()\n    L.append([s, -int(p), i+1])\n\nL.sort()\nfor i in range(n):\n    print((L[i][2]))\n", "passed": true, "time": 0.21, "memory": 14176.0, "status": "done"}, {"code": "n = int(input())\nisp = []\nfor i in range(n):\n    s, p = input().split()\n    p = int(p)\n    isp.append([i+1, s, p])\nisp = sorted(isp, key=lambda x: (x[1], -x[2]))\nfor i in isp:\n    print(i[0])", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "N = int(input())\nrestaurant = [[input().split(), i+1] for i in range(N)]\n\nresta_new = sorted(restaurant, key=lambda x:(x[0][0], -int(x[0][1])))\n#print(resta_new)\n\nfor j in range(N):\n    print((resta_new[j][1]))\n", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "n=int(input())\ndic1={}\nbokk=[]\nlist0=[]\nfor i in range(n):\n  c,p=map(str,input().split())\n  p=int(p)\n  list0.append([c,p])\n  if c not in dic1:\n    dic1[c]=[]\n  dic1[c].append(p)\ndic1=dict(sorted(dic1.items()))\nfor i,k in dic1.items():\n  k.sort(reverse=True)\n  for j in k:\n    bokk.append([i,j])\nfor i in bokk:\n  print(list0.index(i)+1)", "passed": true, "time": 0.15, "memory": 14200.0, "status": "done"}, {"code": "N = int(input())\nl = []\nfor i in range(N):\n  s, p = input().split()\n  l.append([s, int(p), i+1])\n\n# \u5730\u540d\u306b\u95a2\u3057\u3066\u8f9e\u66f8\u9806\u306b / \u70b9\u6570\u306b\u95a2\u3057\u3066\u964d\u9806\u306b\u4e26\u3079\u308b\nl = sorted(l, key=lambda x:(x[0], -x[1]))\nfor i in range(N):\n  print(l[i][2])", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "n = int(input())\nL = []\n\nfor i in range(n):\n  s,p = input().split()\n  L.append([s,int(p),i+1])\nL.sort(key=lambda L:(L[0],-L[1]))\nfor l in L:\n  print(l[2])", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\ntbl = []\ns = []\np = []\nfor i in range(n):\n    l = list(map(str,input().split()))\n    l[1] = int(l[1])\n    l2 = [l[1], l[0], i + 1]\n    tbl.append(l2)\n    s.append(l2[1])\n    p.append(l2[0])\n\np.sort()\np.reverse()\ntbl2 = []\nfor i in range(n):\n    for j in range(n):\n        if(tbl[j][0] == p[i]):\n            tbl2.append(tbl[j])\ns = list(set(s))\ns.sort()\nfor i in range(len(s)):\n    for j in range(len(tbl2)):\n        if (tbl2[j][1] == s[i]):\n            print((tbl2[j][2]))\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "N=int(input())\nli=[]\nfor i in range(N):\n    a,b=input().split()\n    b=int(b)\n    li.append([a,100-b,i+1])\nli.sort()\n\nfor j in range(N):\n    print((li[j][2]))\n", "passed": true, "time": 0.15, "memory": 14128.0, "status": "done"}, {"code": "#import bisect,collections,copy,heapq,itertools,math,numpy,string\nimport sys\n\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\ndef S(): return sys.stdin.readline().rstrip()\ndef LS(): return list(sys.stdin.readline().rstrip().split())\n\nN = I()\nSPs = [LS() for _ in range(N)]\n\ntmp = 1\nfor SP in SPs:\n    \n    SP[1] = int(SP[1])\n    SP.append(tmp)\n    tmp += 1\n\nSPs = sorted(SPs, key=lambda x:(x[0],-x[1]), reverse=False)\n\nfor ans in SPs:\n    print(ans[2])", "passed": true, "time": 0.14, "memory": 14372.0, "status": "done"}, {"code": "n = int(input())\nx = []\nfor i in range(n):\n  s,p=input().split()\n  x.append([s,int(p),i+1])\nx.sort(key=lambda x:(x[0],-x[1]))\nfor i in x:\n  print(i[2])", "passed": true, "time": 0.14, "memory": 14328.0, "status": "done"}, {"code": "N = int(input())\nl = []\nfor i in range(N):\n  s, p = input().split()\n  l.append([i+1, s, int(p)])\n\nl = sorted(l, key=lambda x:(x[1], -x[2]))\nfor i in range(N):\n  print(l[i][0])", "passed": true, "time": 0.15, "memory": 14132.0, "status": "done"}, {"code": "n=int(input())\nl=[input().split() for i in range(n)]\nl2=[x for x in range(n)]\nbase=list(zip(l2,l))\nans=sorted(base, key=lambda x: int(x[1][1]),reverse=True)\nans=sorted(ans,key=lambda x: x[1][0])\n\nfor i in range(n):\n    print(1+ans[i][0])", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "n = int(input())\ns = [list(input().split()) for i in range(n)]\nfor i in range(n):\n    s[i][1] = int(s[i][1])\n\nq = sorted(s, key=lambda x: x[1])\nq = sorted(q, key =lambda x: x[1],reverse=True)\nq = sorted(q, key=lambda x: x[0])\n\nfor i in range(n):\n    print(s.index(q[i])+1)", "passed": true, "time": 0.15, "memory": 14320.0, "status": "done"}, {"code": "N = int(input())\nl = []\nfor i in range(N):\n  s, p = input().split()\n  l.append([s, int(p), i+1]) \n\n# \u307e\u305a\u70b9\u6570\u3067\u964d\u9806\u306b\u4e26\u3079\u308b\nl = sorted(l, key=lambda x:(x[1]), reverse=True)\n# \u6b21\u306b\u5730\u540d\u3067\u8f9e\u66f8\u9806\u306b\u4e26\u3079\u308b\nl = sorted(l, key=lambda x:(x[0]))\nfor i in range(N):\n  print(l[i][2])", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "n = int(input())\nL = []\nfor i in range(n):\n  c = []\n  a, b = map(str, input().split())\n  c.append(a)\n  c.append(100-int(b))\n  c.append(i+1)\n  L.append(c)\nL.sort()\nfor j in range(n):\n  print(L[j][2])", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "n=int(input())\nl=[]\nfor i in range(n):\n    city,point=input().split()\n    point=int(point)\n    l.append((city,-point,i+1))\n\nfor i in sorted(l):\n    print(i[2])", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "n=int(input())\nsp = [input().split() for _ in range(n)]\norde=sorted(sp,key=lambda sp:(sp[0],-int(sp[1])))\nfor i in orde:\n\tprint(sp.index(i)+1)", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "N = int(input())\nS = [list(input().split()) for _ in range(N)]\nfor i in S:\n    i[1] = 100 - int(i[1])\nfor i in range(N):\n    S[i] += i+1,\nS.sort()\nfor i in S:\n    print(i[2])", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nimport sys\ndef input():\n    return sys.stdin.readline()[:-1]\n\ndef main():\n    N = int(input())\n    S = [0] * N\n    P = [0] * N\n    R = [0] * N\n    for i in range(N):\n        S[i] , P[i] = list(map(str, input().split()))\n    for i in range(N):\n        R[i] = i + 1\n    for i in range(N):\n        P[i] = int(P[i]) * -1\n\n\n    Z = list(zip(S, P, R))\n    Z = sorted(Z)\n    S, P, R = list(zip(*Z))\n\n    for i in R:\n        print(i)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "n = int(input())\nrestaurants = []\nfor i in range(n):\n    s, p = input().split()\n    restaurants.append((s, int(p)))\nsorted_list = sorted(restaurants, key=lambda x:x[1], reverse=True)\nsorted_list.sort(key=lambda x:x[0])\n\nfor i in range(n):\n    print(restaurants.index(sorted_list[i]) + 1)", "passed": true, "time": 0.14, "memory": 14364.0, "status": "done"}, {"code": "n = int(input())\nrest = [list([*input().split(),i+1]) for i in range(n)]\nrest = list(sorted(rest, key = lambda x : (x[0],100 - int(x[1]))))\nfor i in rest:\n    print(i[2])", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "n = int(input())\nlst = []\nfor i in range(n):\n    s, p = input().split()\n    lst.append([s, -(int(p)), i+1])\nlst.sort()\nfor i in range(n):\n    print(lst[i][2])", "passed": true, "time": 0.14, "memory": 14364.0, "status": "done"}, {"code": "n=int(input())\nl=[]\nfor i in range(n):\n  city,point=input().split()\n  point=int(point)\n  l.append((city,point))\n\nl=sorted(enumerate(l), key=lambda x:(x[1][0],-x[1][1]))\n\nfor i,(c,p) in l:\n  print(i+1)", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "N = int(input())\nguidebook = []\nfor i in range(N):\n    S, P = input().split()\n    P = int(P)\n    guidebook.append([S,P])\n\nnew_guidebook = sorted(guidebook, key=lambda x: (x[0],-x[1]))\n\nfor i in new_guidebook:\n    print((guidebook.index(i)+1))\n", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "n = int(input())\n\nrestaurant = []\n\nfor i in range(n):\n    score_list = input().split()\n    score_list.append(i+1)\n    score_list[1] = int(score_list[1])\n    restaurant.append(score_list)\n\nfor l in sorted(restaurant, key=lambda x: (x[0], -x[1])):\n    print(l[2])", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "\nurl = \"https://atcoder.jp//contests/abc128/tasks/abc128_b\"\n\ndef main():\n    n = int(input())\n    town = {}\n    for i in range(n):\n        t = list(input().split())\n        town.setdefault(t[0], {})\n        town[t[0]][i+1] = int(t[1])\n    town = sorted(list(town.items()), key=lambda x:x[0])\n    for k in town:\n        sort_town = sorted(list(k[1].items()), key=lambda x:x[1], reverse=True)\n        for v in sort_town:\n            print((v[0]))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}]