
fun main(args:Array<String>):Unit {
    val a = readLine()!!.split(' ').map(String::toInt)
    println(Time(a[3], a[4], a[5]) - Time(a[0], a[1], a[2]))
    val b = readLine()!!.split(' ').map(String::toInt)
    println(Time(b[3], b[4], b[5]) - Time(b[0], b[1], b[2]))
    val c = readLine()!!.split(' ').map(String::toInt)
    println(Time(c[3], c[4], c[5]) - Time(c[0], c[1], c[2]))
}
class Time(hour:Int, minute:Int, second:Int){
    private constructor(second:Int):this(second / 3600, (second % 3600) / 60, second % 60)
    private val mSecond = second % 60
    private val mMinute = (second / 60 + minute) % 60
    private val mHour = ((second / 60) + minute) / 60 + hour
    override fun toString(): String = "$mHour $mMinute $mSecond"
    operator fun plus(other:Time):Time = Time(mHour + other.mHour, mMinute + other.mMinute, mSecond + other.mSecond)
    operator fun minus(other:Time):Time = Time(mHour * 3600 + mMinute * 60 + mSecond - other.mHour * 3600 - other.mMinute * 60 - other.mSecond)
}
