you can just check at the clock and tell.
int q;
scanf("%d",&q);
int h[q],m[q];
for(int i=0;i<q;i++){
scanf("%02d:%02d",&h[i],&m[i]);
}
for(int i=0;i<q;i++){
if(h[i]==12){
printf("12:00\n");
}
else{
printf("%02d:00\n",(12-h[i]));
}
}
return 0;