Difference between following 3 answers for problem - Chef and Football Match

Hello chefs, will you please explain me why the 1st one is correct why not 2nd and 3rd for the problem : https://www.codechef.com/problems/WATCHFB?

1st solution

for _ in range(int(input())):
n = int(input())
p,pa,pb,f = 2,0,0,0
for _ in range(n):
    m,a,b = map(int,input().split())
    if a==b or m==1:
        print('YES')
        pa,pb = a,b
        f = 1
    elif m==2:
        if f==0:
            print('NO')
        elif min(a,b) < max(pa,pb):
            print('YES')
            pa,pb = a,b
        else:
            print('NO')

2nd solution

for _ in range(int(input())):
n = int(input())
p,pa,pb,f = 2,0,0,0
for _ in range(n):
    m,a,b = map(int,input().split())
    if a==b or m==1:
        print('YES')
        p,pa,pb = m,a,b
        f = 1
    elif p==2:
        if f==0:
            print('NO')
        elif a < max(pa,pb) or b<max(pa,pb):
            print('YES')
        else:
            print('NO')
        p,pa,pb = m,a,b

3rd solution

for _ in range(int(input())):
    n = int(input())
    p,pa,pb = 2,0,0
    for _ in range(n):
        m,a,b = map(int,input().split())
        if m == 1 or a==b:
            print('YES')
            p,pa,pb = m,a,b
        else:
            if pa==pb:
                print('NO')
            elif min(a,b) < max(pa,pb):
                print('YES')
            else:
                print('NO')
            p,pa,pb = m,a,b

Thanks for the help @down_the_bit