fork download
  1. #include <bits/stdc++.h>
  2. #define sz(x) (int) x.size()
  3. #define pb push_back
  4. #define all(x) x.begin(), x.end()
  5. using namespace std;
  6.  
  7. int main() {
  8. int t;
  9. while(cin >> t) {
  10. vector<pair<int, string>> a(t);
  11. for(auto& [d, n] : a) cin >> n >> d;
  12. sort(all(a));
  13.  
  14. for(int i=0; i<t; i++) {
  15. if(i > 0) cout << " ";
  16. cout << a[i].second;
  17. }
  18. cout << endl;
  19. }
  20. }
  21.  
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
Standard output is empty