#include <bits/stdc++.h> #include<math.h> using namespace std; const int MAX_LEN = 100005; struct Person{ char name[15]; int HH; int MM; int SS; int HH1; int MM1; int SS1; }early,lately; int main(){ early.HH = 24; early.MM = 0; early.SS = 0; lately.HH = 0; lately.MM = 0; lately.SS = 0; int n; cin>>n; for(int i=0;i<n;++i){ Person temp; scanf("%s %d:%d:%d %d:%d:%d",temp.name,&temp.HH,&temp.MM,&temp.SS,&temp.HH1,&temp.MM1,&temp.SS1); if(temp.HH<early.HH || (temp.HH == early.HH && temp.MM<early.MM)||(temp.HH==early.HH && temp.MM == early.MM && temp.SS<early.SS)){ early.HH = temp.HH; early.MM = temp.MM; early.SS = temp.SS; //early.name = temp.name; memset(early.name,'