#include<stdio.h> int main() { // freopen("1.txt","r",stdin); int n,h,m,s,h1,m1,s1; scanf("%d",&n); while(n--) { int h2=0,m2=0,s2=0; scanf("%d:%d:%d %d:%d:%d",&h,&m,&s,&h1,&m1,&s1); if(s>=s1) s2=s-s1; else { m--; s2=s-s1+60; } if(m>=m1) m2=m-m1; else { h--; m2=m-m1+60; } if(h>=h1) h2=h-h1; else { h2=h-h1; while(h2<0) h2+=12; } printf("%02d:%02d:%02d\n",h2,m2,s2); } return 0; }