#K71532. Synchronizing Server Times to GMT

    ID: 33552 Type: Default 1000ms 256MiB

Synchronizing Server Times to GMT

Synchronizing Server Times to GMT

In this problem, you are given the local times of multiple servers along with their respective timezone offsets. Your task is to synchronize all these server times to Greenwich Mean Time (GMT). For each server, you are provided with a time in (HH:MM:SS) format and an integer representing the timezone offset in hours. The GMT time should be computed using the formula: [ \text{GMT time} = \text{local time} - \text{offset}\times1\text{ hour} ] Note that time adjustments may result in crossing midnight (i.e., the day wraps around), so proper modulo operations (modulo (86400) seconds) must be applied. The output should be the adjusted GMT time in (HH:MM:SS) format for each server, printed on separate lines.

inputFormat

The input begins with an integer (T) denoting the number of test cases. For each test case, the first line contains an integer (N) representing the number of servers. This is followed by (N) lines, each containing a time string in the format (HH:MM:SS) and an integer indicating the timezone offset (in hours) separated by a space.

outputFormat

For each server in all test cases, output the synchronized GMT time in (HH:MM:SS) format. Each output should be printed on a separate line.## sample

1
2
10:45:05 +5
23:59:59 -3
05:45:05

02:59:59

</p>