#include #include #include #include using namespace std; struct Takmicar { string ime; int poeni; bool operator<(const Takmicar &other) { return poeni > other.poeni || (poeni == other.poeni && ime < other.ime); } }; int main(void) { int n; cin >> n; vector t(n); for (int i = 0; i < n; i++) { cin >> t[i].ime >> t[i].poeni; } int c = 5; sort(t.rbegin(), t.rend()); for (int i = 0; i < n; i++) { cout << t[i].ime << " " << t[i].poeni << endl; } return 0; }