#include<stdio.h>
int main(){
int i, n, h1, h2, m1, m2, s1, s2, temp1=100,temp2=100, temp3=100, k1=0;
int temp4=0, temp5=0, temp6=0, k2=0;
char a[1000][17];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%d:%d:%d %d:%d:%d", a[i], &h1,&m1,&s1,&h2,&m2,&s2);
if( h1<temp1 || (h1==temp1&&m1<temp2) || (h1==temp1&&m1==temp2&&s1<temp3) )
{temp1=h1;temp2=m1;temp3=s1;k1=i;}
if( h2>temp4 || (h2==temp4&&m2>temp5) || (h2==temp4&&m2==temp4&&s2>temp6) )
{temp4=h2;temp5=m2;temp6=s2;k2=i;}
}
printf("%s %s\n",a[k1],a[k2]);
return 0;
}
PAT-A1006
最新推荐文章于 2022-11-13 18:23:03 发布