Chef And FootBall - WATCHFB ( HELP)

Can anyone please point out my mistake …??

https://www.codechef.com/viewsolution/26826245

#include<bits/stdc++.h>
#include
#define ll long long int

using namespace std;

int main(){

ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

ll t;  cin>>t;

while(t--){

    ll n;  cin>>n;
    int op,a,b;
    int SA = 0, SB = 0, flag = 0;

    while(n--){
        cin>>op>>a>>b;

        if(flag == 0 && op == 2){
            cout<<"NO"<<endl;
            flag = 1;
        }
        else if(op == 1){
            cout<<"YES"<<endl;
            SA =a;
            SB =b;
        }
        else if(op == 2){
            int mx = max(a,b);
            int mn = min(a,b);
            if(a == b){
                cout<<"YES"<<endl;
                SA =a;
                SB =b;
            }
            else if(SA == SB && a != b){
                cout<<"NO"<<endl;
            }
            else if((SA >= mn && SA <=mx) || (SB >= mn && SB <=mx)){
                cout<<"NO"<<endl;
            }
            else if(SA >= mn && SA <=mx && SB <= SA && SB <= mn){
                cout<<"YES"<<endl;
                SA = mx;
                SB = mn;
            }
            else if(SB >= mn && SB <=mx && SA <= SB && SA <= mn){
               cout<<"YES"<<endl;
                SA = mn;
                SB = mx;
            }
            else{
                cout<<"NO"<<endl;
            }
        }
     //   cout<<"SA "<<SA<<" SB "<<SB<<endl;
    }
}

return 0;
}

Check out this test case:

1
6
1 1 3
2 2 3
2 3 5
2 5 6
2 8 8
2 9 10
Output should be:
YES
YES
NO
NO
YES
NO

@smile_forever Which case did i missed…??

@rk_221b Check out this test case:

1
6
1 1 3
2 2 3
2 3 5
2 5 6
2 8 8
2 9 10

In 1st reply, score determination is Possible
In 2nd reply, score determination is Possible because score of team B was 3, and that never be decreased. so Chef’s favorite team score is 2 and others team score remain unchanged ( = 3). Therefor expected output should be YES BUT your solution output NO
Hope this help you to fix it.