Задачи
Birthdates
include <bits/stdc++.h>
define ll long long int
define ld long double
using namespace std; struct points{
string k;
ll x, y, z;
}; bool comp(points a, points b){
if(a.z == b.z){
if(a.y == b.y){
return a.x > b.x;
}
return a.y > b.y;
}
return a.z > b.z;
} int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, x, y, z;
string k;
cin>>n;
vector<points>v;
for(int i = 0; i<n; i++){
cin>>k>>x>>y>>z;
v.push_back({k, x, y, z});
}
sort(v.begin(), v.end(), comp);
cout<<v[0].k<<endl<<v[v.size()-1].k;
} //TECHNOBLADE NEVER DIES