Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n;
  cin>>n;
  vector<int>p(n);
  vector<string>s(n);
  rep(i,n) {
    cin>>s[i]>>p[i];
    p[i]--;
  }
  vector<tuple<string,int,int>>mp;
  rep(i,n){
    mp.push_back(make_tuple(s[i],p[i],i));
  }
  sort(all(mp));
  rep(i,n-1){
    if(mp[i].first==mp[i+1].first && mp[i].second<mp[i+1].second){
      int tmp=mp[i].second;
      mp[i].second=mp[i+1].second;
      mp[i+1].second=tmp;
    }
  }
  rep(i,n){
    cout<<mp[i].third+1<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'first'
   30 |     if(mp[i].first==mp[i+1].first && mp[i].second<mp[i+1].second){
      |              ^~~~~
a.cc:30:29: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'first'
   30 |     if(mp[i].first==mp[i+1].first && mp[i].second<mp[i+1].second){
      |                             ^~~~~
a.cc:30:44: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'second'
   30 |     if(mp[i].first==mp[i+1].first && mp[i].second<mp[i+1].second){
      |                                            ^~~~~~
a.cc:30:59: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'second'
   30 |     if(mp[i].first==mp[i+1].first && mp[i].second<mp[i+1].second){
      |                                                           ^~~~~~
a.cc:31:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'second'
   31 |       int tmp=mp[i].second;
      |                     ^~~~~~
a.cc:32:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'second'
   32 |       mp[i].second=mp[i+1].second;
      |             ^~~~~~
a.cc:32:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'second'
   32 |       mp[i].second=mp[i+1].second;
      |                            ^~~~~~
a.cc:33:15: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'second'
   33 |       mp[i+1].second=tmp;
      |               ^~~~~~
a.cc:37:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'third'
   37 |     cout<<mp[i].third+1<<endl;
      |                 ^~~~~