let rec routable step (pTxy: int [], txy: int []) =
    if step = (Array.head txy) - (Array.head pTxy) then
        Array.tail pTxy = Array.tail txy
    else
        let [|t; x; y|] = pTxy
        routable (step + 1) ([|t; x + 1; y|], txy)
        || routable (step + 1) ([|t; x - 1; y|], txy)
        || routable (step + 1) ([|t; x; y + 1|], txy)
        || routable (step + 1) ([|t; x; y - 1|], txy)

let n = stdin.ReadLine() |> int
let txys = Seq.append [[|0; 0; 0|]] [for i in 1..n do yield stdin.ReadLine().Split(' ') |> Array.map int]
txys
|> Seq.pairwise
|> Seq.forall (routable 0)
|> fun r -> if r then "Yes" else "No"
|> printfn "%s"
