#include<iostream>
using namespace std;int getTime(){int h1, h2, m1, m2, s1, s2, d = 0;//d一定初始化为0,以正确处理不跨天的情况 scanf("%d:%d:%d %d:%d:%d (+%d)", &h1, &m1, &s1, &h2, &m2, &s2, &d);return d * 24 * 3600 + h2 * 3600 + m2 * 60 + s2 - h1 * 3600 - m1 * 60 - s1;
}int main(){int n, t1, t2, ans;scanf("%d", &n);while(n--){//两地之间时间差是互为逆运算的,所以往返航程间的时间差可以抵消==>用往返行程时间相加再除二,得实际飞行时间 t1 = getTime();t2 = getTime();ans = (t1 + t2) / 2;printf("%02d:%02d:%02d\n", ans / 3600 % 24, ans / 60 % 60, ans % 60);}return 0;
}