- map以红黑树实现:字典序
- 迭代器可以++、--,但不支持+1
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
int n;
string number,timein,timeout;//证件号、进入时间,退出时间
while(scanf("%d",&n)!=EOF){
map<string,string>First;
map<string,string>Last;
while(n--){
cin>>number>>timein>>timeout;
First[timein]=number;
Last[timeout]=number;
}
cout<<(First.begin())->second<<" "<<(--Last.end())->second <<endl;
}
return 0;
}