#include<bits/stdc++.h>
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
using namespace std;
int main()
{
int t;
string s;
cin>>t;
vector<pair<int , string> >v;
while(t--){
int d , m , y;
cin>>s>>d>>m>>y;
int convert=d+(m*100)+(y*1000);
v.push_back({convert,s});
}
sort(v.begin(),v.end());
cout<<v[v.size()-1].second<<endl;
cout<<v[0].second<<endl;
return 0;
}
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
#define newl cout<<"\n"
#define putcase cout<<"Case "<<++cse<<":"
using namespace std;
int main()
{
int t;
string s;
cin>>t;
vector<pair<int , string> >v;
while(t--){
int d , m , y;
cin>>s>>d>>m>>y;
int convert=d+(m*100)+(y*1000);
v.push_back({convert,s});
}
sort(v.begin(),v.end());
cout<<v[v.size()-1].second<<endl;
cout<<v[0].second<<endl;
return 0;
}
No comments:
Post a Comment