#include <iostream> #include <string> using namespace std; int main() { int n; int h, m, s; int AH, AM, AS, BH, BM, BS; int flag = 0; cin >> n; while (n--) { cin >> AH >> AM >> AS; cin >> BH >> BM >> BS; flag = 0; s = AS + BS; if (s >= 60) { s %= 60; flag = 1; } m = AM + BM + flag; if (m >= 60) { m %= 60; flag = 1; } h = AH + BH + flag; //if (h >= 24) //{ // h %= 24; //flag = 1; //} cout << h << " " << m << " " << s << endl; } }