#include <stdio.h>
#include <stdlib.h>
// write your code here......
typedef struct Clock myclock_t;
typedef struct Clock {
int hour;
int minute;
int second;
int sum_seconds;
void (*set_clock)(myclock_t* obj, int seconds);
void (*print_clock)(myclock_t* obj);
} myclock_t;
void SetClock(myclock_t* obj, int seconds) {
obj->sum_seconds += seconds;
obj->sum_seconds %= 24 * 3600;
obj->hour = obj->sum_seconds / 3600;
obj->minute = (obj->sum_seconds % 3600) / 60;
obj->second = obj->sum_seconds % 60;
}
void PrintTime(myclock_t* obj) {
printf("%d %d %d\n", obj->hour, obj->minute, obj->second);
}
int main() {
int n;
scanf("%d", &n);
int* seconds = (int*)malloc(n * sizeof(int));
for (int i = 0; i < n; i++) {
scanf("%d", &seconds[i]);
}
// write your code here......
myclock_t cl = {
.hour = 0,
.minute = 0,
.second = 0,
.sum_seconds = 0,
.set_clock = SetClock,
.print_clock = PrintTime
};
for (int i = 0; i < n; i++) {
cl.set_clock(&cl, seconds[i]);
cl.print_clock(&cl);
}
free(seconds);
return 0;
}