Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

option = {(0, 0)}


def main():
    global option
    last_list = [0, 0, 0]
    N = int(input())
    for i in range(N):
        this_list = list(map(int, input().split()))
        add_option(this_list[0] - last_list[0], (this_list[1], this_list[2]))
        if (this_list[1], this_list[2]) not in option:
            print('No')
            return
        option = {(this_list[1], this_list[2])}
        last_list = this_list
    print('Yes')


def add_option(step, this_postion):
    global option
    xi, yi = this_postion
    for i in range(step):
        temp_option = set()
        rest = step - i
        for position in option:
            x, y = position
            diff = abs(x - xi) + abs(y - yi)
            if rest % 2 != diff % 2:
                continue
            if diff > rest:
                continue
            if x < 100000:
                temp_option.add((x + 1, y))
            if y < 100000:
                temp_option.add((x, y + 1))
            if x > 0:
                temp_option.add((x - 1, y))
            if y > 0:
                temp_option.add((x, y - 1))
        option = temp_option


main()


Fixed submission:
# -*- coding: utf-8 -*-

judge = 'Yes'

N = int(input())
for i in range(N):
    t, x, y = map(int, input().split())
    if t < (x + y) or t % 2 != (x + y) % 2:
        judge = 'No'

print(judge)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

option = {(0, 0)}


def main():
    global option
    last_list = [0, 0, 0]
    N = int(input())
    for i in range(N):
        this_list = list(map(int, input().split()))
        add_option(this_list[0] - last_list[0], (this_list[1], this_list[2]))
        if (this_list[1], this_list[2]) not in option:
            print('No')
            return
        option = {(this_list[1], this_list[2])}
        last_list = this_list
    print('Yes')


def add_option(step, this_postion):
    global option
    xi, yi = this_postion
    for i in range(step):
        temp_option = set()
        for position in option:
            x, y = position
            diff = abs(x - xi) + abs(y - yi)
            rest = step - i
            if diff > rest:
                continue
            if x < 100000:
                temp_option.add((x + 1, y))
            if y < 100000:
                temp_option.add((x, y + 1))
            if x > 0:
                temp_option.add((x - 1, y))
            if y > 0:
                temp_option.add((x, y - 1))
        option = temp_option


main()


Fixed submission:
# -*- coding: utf-8 -*-

judge = 'Yes'

N = int(input())
for i in range(N):
    t, x, y = map(int, input().split())
    if t < (x + y) or t % 2 != (x + y) % 2:
        judge = 'No'

print(judge)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

option = {(0, 0)}


def main():
    global option
    last_list = [0, 0, 0]
    N = int(input())
    for i in range(N):
        this_list = list(map(int, input().split()))
        add_option(this_list[0] - last_list[0])
        if (this_list[1], this_list[2]) not in option:
            print('No')
            return
        option = {(this_list[1], this_list[2])}
        last_list = this_list
    print('Yes')


def add_option(step):
    global option
    for i in range(step):
        temp_option = set()
        for position in option:
            x, y = position
            if x < 100000:
                temp_option.add((x + 1, y))
            if y < 100000:
                temp_option.add((x, y + 1))
            if x > 0:
                temp_option.add((x - 1, y))
            if y > 0:
                temp_option.add((x, y - 1))
        option = temp_option


main()


Fixed submission:
# -*- coding: utf-8 -*-

judge = 'Yes'

N = int(input())
for i in range(N):
    t, x, y = map(int, input().split())
    if t < (x + y) or t % 2 != (x + y) % 2:
        judge = 'No'

print(judge)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

option = {(0, 0)}


def main():
    global option
    last_list = [0, 0, 0]
    N = int(input())
    for i in range(N):
        this_list = list(map(int, input().split()))
        add_option(this_list[0] - last_list[0])
        if (this_list[1], this_list[2]) not in option:
            print('No')
            return
        option = {(this_list[1], this_list[2])}
        last_list = this_list
    print('Yes')


def add_option(step):
    global option
    for i in range(step):
        temp_option = set()
        for position in option:
            x, y = position
            temp_option.add((x + 1, y))
            temp_option.add((x, y + 1))
            if x > 0:
                temp_option.add((x - 1, y))
            if y > 0:
                temp_option.add((x, y - 1))
        option = temp_option


main()


Fixed submission:
# -*- coding: utf-8 -*-

judge = 'Yes'

N = int(input())
for i in range(N):
    t, x, y = map(int, input().split())
    if t < (x + y) or t % 2 != (x + y) % 2:
        judge = 'No'

print(judge)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

option = {(0, 0)}


def main():
    global option
    last_list = [0, 0, 0]
    N = int(input())
    for i in range(N):
        this_list = list(map(int, input().split()))
        add_option(this_list[0] - last_list[0])
        if (this_list[1], this_list[2]) not in option:
            print('No')
            return
        option = {(this_list[1], this_list[2])}
        last_list = this_list
    print('Yes')


def add_option(step):
    global option
    for i in range(step):
        temp_option = set()
        for position in option:
            x, y = position
            temp_option.add((x + 1, y))
            temp_option.add((x, y + 1))
            if x > 0:
                temp_option.add((x - 1, y))
            if y > 0:
                temp_option.add((x, y - 1))
        option = temp_option


main()


Fixed submission:
# -*- coding: utf-8 -*-

judge = 'Yes'

N = int(input())
for i in range(N):
    t, x, y = map(int, input().split())
    if t < (x + y) or t % 2 != (x + y) % 2:
        judge = 'No'

print(judge)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

option = {(0, 0)}


def main():
    global option
    last_list = [0, 0, 0]
    N = int(input())
    for i in range(N):
        this_list = list(map(int, input().split()))
        add_option(this_list[0] - last_list[0])
        if (this_list[1], this_list[2]) not in option:
            print('No')
            return
        last_list = this_list
    print('Yes')


def add_option(step):
    global option
    for i in range(step):
        temp_option = set()
        for position in option:
            x, y = position
            temp_option.add((x + 1, y))
            temp_option.add((x, y + 1))
            if x > 0:
                temp_option.add((x - 1, y))
            if y > 0:
                temp_option.add((x, y - 1))
        option = temp_option


main()


Fixed submission:
# -*- coding: utf-8 -*-

judge = 'Yes'

N = int(input())
for i in range(N):
    t, x, y = map(int, input().split())
    if t < (x + y) or t % 2 != (x + y) % 2:
        judge = 'No'

print(judge)