# include <stdio.h>
# define N 100000
struct people
{
char name[ 6 ] ;
int year;
int month;
int day;
} ;
void swap ( struct people * a, struct people * b) ;
void main ( )
{
struct people num[ N] ;
struct people * s[ N] ;
int i= - 1 , t, n, j;
scanf ( "%d" , & n) ;
for ( t= 0 ; t< n; t++ ) {
i++ ;
s[ t] = & num[ t] ;
scanf ( "%s%d/%d/%d" , s[ i] -> name, & s[ i] -> year, & s[ i] -> month, & s[ i] -> day) ;
if ( s[ i] -> year> 2014 ) {
i-- ; continue ;
} else {
if ( s[ i] -> year== 2014 ) {
if ( s[ i] -> month> 9 ) {
i-- ; continue ;
} else {
if ( s[ i] -> month== 9 ) {
if ( s[ i] -> day> 6 ) {
i-- ; continue ;
}
}
}
}
}
if ( s[ i] -> year< 1814 ) {
i-- ; continue ;
} else {
if ( s[ i] -> year== 1814 ) {
if ( s[ i] -> month< 9 ) {
i-- ; continue ;
} else {
if ( s[ i] -> month== 9 ) {
if ( s[ i] -> day< 6 ) {
i-- ; continue ;
}
}
}
}
}
}
printf ( "%d" , i+ 1 ) ;
n= i+ 1 ;
for ( i= 0 ; i< n; i++ ) {
for ( j= i+ 1 ; j< n; j++ ) {
if ( s[ i] -> year> s[ j] -> year) {
swap ( s[ i] , s[ j] ) ;
}
if ( s[ i] -> year== s[ j] -> year) {
if ( s[ i] -> month> s[ j] -> month) {
swap ( s[ i] , s[ j] ) ;
}
if ( s[ i] -> month== s[ j] -> month) {
if ( s[ i] -> day> s[ j] -> day) {
swap ( s[ i] , s[ j] ) ;
}
}
}
}
}
if ( n>= 2 ) {
printf ( " %s %s\n" , s[ 0 ] -> name, s[ n- 1 ] -> name) ;
} else {
if ( n== 1 ) {
printf ( " %s\n" , s[ 0 ] -> name) ;
}
}
}
void swap ( struct people * a, struct people * b)
{
struct people item;
item= * a;
* a= * b;
* b= item;
}
# include <stdio.h>
# include <string.h>
int main ( )
{
int N, i, count= 0 ;
char inform[ 17 ] , eldest[ 17 ] = { '9' } , youngest[ 17 ] = { '0' } ;
scanf ( "%d" , & N) ;
for ( i= 0 ; i< N; i++ ) {
scanf ( "%s %s" , inform+ 11 , inform) ;
if ( strcmp ( inform, "1814/09/06" ) >= 0 && strcmp ( inform, "2014/09/06" ) <= 0 ) {
if ( strcmp ( inform, eldest) <= 0 ) {
memcpy ( eldest, inform, 17 ) ;
}
if ( strcmp ( inform, youngest) >= 0 ) {
memcpy ( youngest, inform, 17 ) ;
}
count++ ;
}
}
if ( count) {
printf ( "%d %s %s\n" , count, eldest+ 11 , youngest+ 11 ) ;
} else {
printf ( "0\n" ) ;
}
return 0 ;
}