{"problem":{"name":"Guidebook","description":{"content":"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","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc128_b"},"statements":[{"statement_type":"Markdown","content":"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.\nYou want to introduce the restaurants in the following order:\n\n*   The restaurants are arranged in lexicographical order of the names of their cities.\n*   If there are multiple restaurants in the same city, they are arranged in descending order of score.\n\nPrint the identification numbers of the restaurants in the order they are introduced in the book.\n\n## Constraints\n\n*   $1 ≤ N ≤ 100$\n*   $S$ is a string of length between $1$ and $10$ (inclusive) consisting of lowercase English letters.\n*   $0 ≤ P_i ≤ 100$\n*   $P_i$ is an integer.\n*   $P_i ≠ P_j$ $(1 ≤ i < j ≤ N)$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$S_1$ $P_1$\n$:$\n$S_N$ $P_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc128_b","tags":[],"sample_group":[["6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40","3\n4\n6\n1\n5\n2\n\nThe 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$."],["10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100","10\n9\n8\n7\n6\n5\n4\n3\n2\n1"]],"created_at":"2026-03-03 11:01:14"}}