1 #include<iostream>
2 using namespace std;
3 class Time
4 {
5 private:
6 int hh;
7 int mm;
8 int ss;
9 public:
10 Time()
11 {
12 hh = 0;
13 mm = 0;
14 ss = 0;
15 }
16 void set(int h,int m,int s)
17 {
18 hh=h;
19 mm=m;
20 ss=s;
21 }
22 friend bool operator >(Time &t1,Time &t2);
23 friend ostream & operator <<(ostream &,Time &);
24 } ;
25 bool operator >(Time &t1,Time &t2)
26 {
27 int re1=t1.hh*3600+t1.mm*60+t1.ss;
28 int re2=t2.hh*3600+t2.mm*60+t2.ss;
29 if(re1>re2)
30 {
31 return true;
32 }
33 else
34 {
35 return false;
36 }
37 }
38
39 ostream &operator <<(ostream &output,Time&t)
40 {
41 output<<t.hh<<" "<<t.mm<<" "<<t.ss;
42 return output;
43 }
44
45 class date
46 {
47 private:
48 int year;
49 int month;
50 int day;
51 public:
52 date()
53 {
54 year = 0;
55 month = 0;
56 day = 0;
57 }
58 void set(int y,int m,int d)
59 {
60 year=y;
61 month=m;
62 day=d;
63 }
64 friend bool operator >(date &d1,date &d2);
65 friend ostream & operator <<(ostream &,date &);
66 };
67
68 bool operator >(date &d1,date &d2)
69 {
70 int re1=d1.year*365+d1.month*30+d1.day;
71 int re2=d2.year*365+d2.month*30+d2.day;
72 if(re1>re2)
73 {
74 return true;
75 }
76 else
77 {
78 return false;
79 }
80 }
81
82 ostream & operator <<(ostream &output,date &d)
83 {
84 output<<d.year<<" "<<d.month<<" "<<d.day;
85 return output;
86 }
87
88 template <class T>
89 T maxn(T x[], int len)
90 {
91 T max;
92 max=x[0];
93 for(int i=0; i<len; i++)
94 {
95 if(x[i]>max)
96 {
97 max=x[i];
98 }
99 }
100 cout<<max<<endl;
101 return max;
102 }
103
104 int main()
105 {
106 int intArray[100];
107
108 double douArray[100];
109 Time TimeArray[100];
110 date dateArray[100];
111 int ch;
112 int i=0;
113 while(cin>>ch)
114 {
115 if(ch==-1)
116 {
117 break;
118 }
119 if(ch==1)
120 {
121 while(cin>>intArray[i])
122 {
123 if(intArray[i]==0)
124 {
125 break;
126 }
127 i++;
128 }
129 maxn(intArray,i);
130 }
131 if(ch==2)
132 {
133 while(cin>>douArray[i])
134 {
135 if(douArray[i]==0)
136 {
137 break;
138 }
139 i++;
140 }
141 maxn(douArray,i);
142 }
143 if(ch==3)
144 {
145 int hour,minute,second;
146 while(cin>>hour)
147 {
148 if(hour==0)
149 {
150 break;
151 }
152 cin>>minute>>second;
153 TimeArray[i].set(hour,minute,second);
154 i++;
155 }
156 maxn(TimeArray,i);
157 }
158 if(ch==4)
159 {
160 int years,months,days;
161
162 while(cin>>years)
163 {
164 if(years==0)
165 {
166 break;
167 }
168 cin>>months>>days;
169 dateArray[i].set(years,months,days);
170 i++;
171 }
172 maxn(dateArray,i);
173 }
174 }
175 return 0;
176 }