#include <iostream>
#include <iomanip>

class Time {
public:
    int hour, minute, second;

    // 构造函数
    Time(int h = 0, int m = 0, int s = 0) : hour(h), minute(m), second(s) {}

    // 输入运算符重载
    friend std::istream& operator>>(std::istream& is, Time& t) {
        is >> t.hour >> t.minute >> t.second;
        return is;
    }

    // 输出运算符重载
    friend std::ostream& operator<<(std::ostream& os, const Time& t) {
        os << std::setw(2) << std::setfill('0') << t.hour << ":"
           << std::setw(2) << std::setfill('0') << t.minute << ":"
           << std::setw(2) << std::setfill('0') << t.second;
        return os;
    }

    // += 运算符重载
    Time& operator+=(const Time& t) {
        this->second += t.second;
        this->minute += t.minute + this->second / 60;
        this->hour += t.hour + this->minute / 60;
        this->second %= 60;
        this->minute %= 60;
        this->hour %= 24;
        return *this;
    }

    // -= 运算符重载
    Time& operator-=(const Time& t) {
        int totalSeconds1 = this->hour * 3600 + this->minute * 60 + this->second;
        int totalSeconds2 = t.hour * 3600 + t.minute * 60 + t.second;
        int totalSeconds = totalSeconds1 - totalSeconds2;

        if (totalSeconds < 0) {
            totalSeconds += 24 * 3600;
        }

        this->hour = (totalSeconds / 3600) % 24;
        this->minute = (totalSeconds % 3600) / 60;
        this->second = totalSeconds % 60;

        return *this;
    }

    // 前置++运算符重载
    Time& operator++() {
        this->second++;
        if (this->second >= 60) {
            this->second = 0;
            this->minute++;
            if (this->minute >= 60) {
                this->minute = 0;
                this->hour++;
                if (this->hour >= 24) {
                    this->hour = 0;
                }
            }
        }
        return *this;
    }

    // 后置++运算符重载
    Time operator++(int) {
        Time temp = *this;
        ++(*this);
        return temp;
    }

    // 前置--运算符重载
    Time& operator--() {
        if (this->second == 0) {
            this->second = 59;
            if (this->minute == 0) {
                this->minute = 59;
                if (this->hour == 0) {
                    this->hour = 23;
                } else {
                    this->hour--;
                }
            } else {
                this->minute--;
            }
        } else {
            this->second--;
        }
        return *this;
    }

    // 后置--运算符重载
    Time operator--(int) {
        Time temp = *this;
        --(*this);
        return temp;
    }
};

int main() {
    Time time1, time2;
    std::cin >> time1 >> time2;

    std::cout << (time1 += (time2++)) << std::endl;
    std::cout << (time1 -= time2) << std::endl;
    std::cout << (++time2) << std::endl;
    std::cout << (time2 += (time1--)) << std::endl;
    std::cout << (--time1) << std::endl;
    std::cout << (time2 -= time1) << std::endl;

    return 0;
}
