#include<bits/stdc++.h>
using namespace std;
int jisuan(){
int h1,m1,s1,h2,m2,s2,day=0;
scanf("%d:%d:%d %d:%d:%d",&h1,&m1,&s1,&h2,&m2,&s2);
if(getchar()==' ') scanf("(+%d)",&day);
return (day*86400+h2*3600+m2*60+s2)-(h1*3600+m1*60+s1);
}
int main(){
int t;
cin>>t;
while(t--){
int time=(jisuan()+jisuan())/2;
printf("%02d:%02d:%02d\n",time/3600,time%3600/60,time%60);
}
return 0;
}