水题.
#include <iostream>
#include <cstdio>
#include <memory.h>
using namespace std;
int H, M, S;
int main(){
int t;
scanf("%d", &t);
while (t--){
int h, m, s;
scanf("%d:%d:%d %d:%d:%d", &H, &M, &S, &h, &m, &s);
if(S<s){
M--;
}
S = (S - s + 60) % 60;
if(M < 0){
H--;
M = 59;
}
if(M < m){
H--;
}
M = (M - m + 60) % 60;
h %= 12;
if(H < 0){
H = 11;
}
H = (H - h + 12) % 12;
printf("%02d:%02d:%02d\n", H, M, S);
}
return 0;
}