**Problem Link :**

Practice

Contest

*Author:* Pratik Suryawanshi

*Editorialist:* Pratik Suryawanshi

# DIFFICULTY:

Moderate

# PREREQUISITES:

Pairs

# PROBLEM:

chef and his friends have holiday so they decided to go for movie. so total N members

along with chef go to the movie they have lot of time so they are going to see T number

of movies on holiday. chef and his friends took tickits of movie, each tickit have

specific number a1,a2,a3,….,an. and each member of group is named by specific chracter .

the guard on the gate allows members according to number of tickit. so print the order by

which each member of group will be allowed in the theater

# QUICK EXPLANATION:

make pair and sort first column and prind second with respect to first

# EXPLANATION:

make pairs of first and second column like vector<pair<ll,char>>

then sort first column and print secont column with respect to second

# SOLUTIONS:

## Setter's Solution

#pragma GCC optimize(“Ofast”)

#pragma GCC target(“avx,avx2,fma”)

#pragma GCC optimization(“unroll-loops”)

#include <bits/stdc++.h>

using namespace std;

#define tc ll t sc cin >> t sc while (t–)

#define ff first

#define vp vector<pair<ll,char>>

#define sc ;

#define ss second

#define srt sort

#define endl ‘\n’

#define pb push_back

#define pp pop_back

#define mp make_pair

#define modulo 1e9+7

#define ll long long int

#define MAX(a, b) a = max(a, b)

#define MIN(a, b) a = min(a, b)

#define INF 1001001001

const long double pi = 3.141592653;

typedef unsigned int ui;

typedef unsigned long long int ul;

int main()

{

```
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("errorf.txt" , "w" , stderr);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
```

tc

{

vp vect;

int n;

cin >> n;

int arr[n];

int arr1[n];

for(int i=0;i<n;i++)

{

vect.pb( mp(arr[i],arr1[i]));

}

for(int i=0;i<n;i++)

{

cin>> vect[i].ff >> vect[i].ss ;

}

```
srt(vect.begin(), vect.end());
for(int i=0;i<n;i++)
{
cout << vect[i].ss << endl;
}
cout << endl;
```

}

return 0;

}