Buggy python submission (verdict: Time Limit Exceeded):
n,w,h = map(int,input().split())
Yoko = [0] * w
Tate = [0] * h
for i in range(n):
    x,y,r = map(int,input().split())
    for j in range(x - r,x + r):
        if 0 <= j < w:
            Yoko[j] += 1
    for j in range(y- r,y + r):
        if 0 <= j < h:
            Tate[j] += 1
if Yoko.count(0) == 0 or Tate.count(0) == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
import sys
n,w,h = map(int,input().split())
Yoko = []
Tate = []
for i in range(n):
    x,y,r = map(int,input().split())
    Yoko.append([x - r,x + r])
    Tate.append([y - r,y + r])
Yoko = sorted(Yoko)
Tate = sorted(Tate)

if Yoko[0][0] > 0 and Tate[0][0] > 0:
    print("No")
    sys.exit()

Yoko_han = [Yoko[0][0],Yoko[0][1]]
Tate_han = [Tate[0][0],Tate[0][1]]
if Yoko[0][0] <= 0:
    if Yoko_han[1] >= w:
        print("Yes")
        sys.exit()
    else:
        for j in range(1,len(Tate)):
            if Yoko[j][0] <= Yoko_han[1] and Yoko_han[1] < Yoko[j][1]:
                Yoko_han[1] = Yoko[j][1]
                if Yoko_han[1] >= w:
                    print("Yes")
                    sys.exit()
                
            elif Yoko_han[1] < Yoko[j][0]:
                break
if Tate[0][0] > 0:
    print("No")
    sys.exit()
else:
    if Tate_han[1] >= h:
            print("Yes")
            sys.exit()
    else:
        for k in range(1,len(Yoko)):
            if Tate[k][0] <= Tate_han[1] and Tate_han[1] < Tate[k][1]:
                Tate_han[1] = Tate[k][1]
                if Tate_han[1] >= h:
                    print("Yes")
                    sys.exit()
                
            elif Yoko_han[1] < Yoko[k][0]:
                print("No")
                sys.exit()
print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,w,h = map(int,input().split())
Yoko = [0] * w
Tate = [0] * h
for i in range(n):
    x,y,r = map(int,input().split())
    for j in range(x - r,x + r):
        if 0 <= j < w:
            Yoko[j] += 1
    for j in range(y- r,y + r):
        if 0 <= j < h:
            Tate[j] += 1
    if Yoko.count(0) == 0 or Tate.count(0) == 0:
        break
if Yoko.count(0) == 0 or Tate.count(0) == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
import sys
n,w,h = map(int,input().split())
Yoko = []
Tate = []
for i in range(n):
    x,y,r = map(int,input().split())
    Yoko.append([x - r,x + r])
    Tate.append([y - r,y + r])
Yoko = sorted(Yoko)
Tate = sorted(Tate)

if Yoko[0][0] > 0 and Tate[0][0] > 0:
    print("No")
    sys.exit()

Yoko_han = [Yoko[0][0],Yoko[0][1]]
Tate_han = [Tate[0][0],Tate[0][1]]
if Yoko[0][0] <= 0:
    if Yoko_han[1] >= w:
        print("Yes")
        sys.exit()
    else:
        for j in range(1,len(Tate)):
            if Yoko[j][0] <= Yoko_han[1] and Yoko_han[1] < Yoko[j][1]:
                Yoko_han[1] = Yoko[j][1]
                if Yoko_han[1] >= w:
                    print("Yes")
                    sys.exit()
                
            elif Yoko_han[1] < Yoko[j][0]:
                break
if Tate[0][0] > 0:
    print("No")
    sys.exit()
else:
    if Tate_han[1] >= h:
            print("Yes")
            sys.exit()
    else:
        for k in range(1,len(Yoko)):
            if Tate[k][0] <= Tate_han[1] and Tate_han[1] < Tate[k][1]:
                Tate_han[1] = Tate[k][1]
                if Tate_han[1] >= h:
                    print("Yes")
                    sys.exit()
                
            elif Yoko_han[1] < Yoko[k][0]:
                print("No")
                sys.exit()
print("No")