Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  
  vector<tuple<string,int,int>> a;
  
  for(int i=1;i<n;i++)
  {
    string s;
    int p;
    
    cin>>s>>p;
    
    p=-p;
    
    a[i]=make_tuple(s,p,i);
    
  }
  
  sort(a.begin(),a.end());
  
  for(int i=1;i<n;i++)
  {
    cout<<get<2>a[i]<<endl;
  }
  
}
using namespace std;
 
int main()
{
  int n;
  cin>>n;
  
  vector<tuple<string,int,int>> a;
  
  for(int i=1;i<n;i++)
  {
    string s;
    int p;
    
    cin>>s>>p;
    
    p=-p;
    
    a[i]=make_tuple(s,p,i);
    
  }
  
  sort(a.begin(),a.end());
  
  for(int i=1;i<n;i++)
  {
    cout<<get<2>a[i]<<endl;
  }
  
}

Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant: In instantiation of 'struct std::variant_alternative<2, std::variant<> >':
/usr/include/c++/14/variant:106:11:   required by substitution of 'template<long unsigned int _Np, class _Variant> using std::variant_alternative_t = typename std::variant_alternative::type [with long unsigned int _Np = 2; _Variant = std::variant<>]'
  106 |     using variant_alternative_t =
      |           ^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/variant:1748:5:   required by substitution of 'template<class _RealType, class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const piecewise_linear_distribution<_RealType>&) [with _RealType = <missing>; _CharT = char; _Traits = std::char_traits<char>]'
 1748 |     get(const variant<_Types...>&& __v)
      |     ^~~
a.cc:28:11:   required from here
   28 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/variant:100:25: error: static assertion failed
  100 |       static_assert(_Np < sizeof...(_Types));
      |                     ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/variant:100:25: note: the comparison reduces to '(2 < 0)'
In file included from /usr/include/c++/14/bits/stl_pair.h:62,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/utility.h: In instantiation of 'struct std::_Nth_type<2>':
/usr/include/c++/14/variant:102:13:   required from 'struct std::variant_alternative<2, std::variant<> >'
  102 |       using type = typename _Nth_type<_Np, _Types...>::type;
      |             ^~~~
/usr/include/c++/14/variant:106:11:   required by substitution of 'template<long unsigned int _Np, class _Variant> using std::variant_alternative_t = typename std::variant_alternative::type [with long unsigned int _Np = 2; _Variant = std::variant<>]'
  106 |     using variant_alternative_t =
      |           ^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/variant:1748:5:   required by substitution of 'template<class _RealType, class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const piecewise_linear_distribution<_RealType>&) [with _RealType = <missing>; _CharT = char; _Traits = std::char_traits<char>]'
 1748 |     get(const variant<_Types...>&& __v)
      |     ^~~
a.cc:28:11:   required from here
   28 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/bits/utility.h:237:13: error: '__type_pack_element' index is out of range
  237 |     { using type = __type_pack_element<_Np, _Types...>; };
      |             ^~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/tuple: In instantiation of 'struct std::tuple_element<2, std::tuple<> >':
/usr/include/c++/14/bits/utility.h:84:11:   required by substitution of 'template<long unsigned int __i, class _Tp> using std::__tuple_element_t = typename std::tuple_element::type [with long unsigned int __i = 2; _Tp = std::tuple<>]'
   84 |     using __tuple_element_t = typename tuple_element<__i, _Tp>::type;
      |           ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2466:5:   required by substitution of 'template<class _RealType, class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const piecewise_linear_distribution<_RealType>&) [with _RealType = <missing>; _CharT = char; _Traits = std::char_traits<char>]'
 2466 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
a.cc:28:11:   required from here
   28 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/tuple:2422:25: error: static assertion failed: tuple index must be in range
 2422 |       static_assert(__i < sizeof...(_Types), "tuple index must be in range");
      |                     ~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/tuple:2422:25: note: the comparison reduces to '(2 < 0)'
a.cc: In function 'int main()':
a.cc:28:11: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 2; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
   28 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
 2476 |     get(const tuple<_Elements...>&) = delete;
      |     ^~~
a.cc:28:11: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 2; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
   28 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
 2476 |     get(const tuple<_Elements...>&) = delete;
      |     ^~~
a.cc:28:11: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 2; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
   28 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
 2476 |     get(const tuple<_Elements...>&) = delete;
      |     ^~~
a.cc:28:17: error: expected ';' before 'a'
   28 |     cout<<get<2>a[i]<<endl;
      |                 ^
      |                 ;
a.cc: At global scope:
a.cc:34:5: error: redefinition of 'int main()'
   34 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
a.cc: In function 'int main()':
a.cc:58:11: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 2; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
   58 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
 2476 |     get(const tuple<_Elements...>&) = delete;
      |     ^~~
a.cc:58:11: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 2; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
   58 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
 2476 |     get(const tuple<_Elements...>&) = delete;
      |     ^~~
a.cc:58:11: error: use of deleted function 'constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&) [with long unsigned int __i = 2; _Elements = {}; __enable_if_t<(__i >= sizeof... (_Types))> = void]'
   58 |     cout<<get<2>a[i]<<endl;
      |           ^~~~~~
/usr/include/c++/14/tuple:2476:5: note: declared here
 2476 |     get(const tuple<_Elements...>&) = delete;
      |     ^~~
a.cc:58:17: error: expected ';' before 'a'
   58 |     cout<<get<2>a[i]<<endl;
      |                 ^
      |                 ;