fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: 0

    var current = Pair(0, 0)
    var now = 0
    var ans = "Yes"
    for (_i in 0 until n) {
        val input = readLine()!!.split(" ").map(String::toInt)
        if (ans == "No") {
            continue
        }
        val d = Math.abs(current.first - input[1]) + Math.abs(current.second - input[2])
        val t = (input[0] - now) % d
        if (t == 3 || t == 0) {
            current = Pair(input[1], input[2])
        } else {
            ans = "No"
        }
        now = input[0]
    }
    println(ans)
}
