#include<iostream>
using namespace std;
int main() {
int ga, ma, sa, gb, mb, sb, sg, sm, ss;
cin >> ga >> ma >> sa >> gb >> mb >> sb;
ss = sa + sb;
sm = ma + mb;
sg = ga + gb;
if (ss >= 60) {
sm = sm + ss / 60;
ss = ss % 60;
}
if (sm >= 60) {
sg = sg + sm / 60;
sm = sm % 60;
}
cout << sg << ' ' << sm << ' ' << ss;
return 0;
}