Задачи
Время учебы
include <bits/stdc++.h>
define ll long long
define ld long double
using namespace std; struct ad{
string x, y;
}; bool comp(ad a, ad b){
if(a.y == b.y){
return a.x < b.x;
}
return a.y < b.y;
} int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
string x, y;
cin>>n;
vector<ad>v;
for(int i = 0; i<n; i++){
cin>>x>>y;
v.push_back({x, y});
}
sort(v.begin(), v.end(), comp);
for(int i = 0; i<v.size(); i++){
cout<<v[i].x<<' '<<v[i].y<<endl;
}
} //TECHNOBLADE NEVER DIE