Help me in solving PROGLANG problem. Why is 0 displayed in other IDEs, but not here?

My issue

My code

#include <iostream>
using namespace std;

int main() {
	
	int t;
	cin >> t;
	
	while(t--){
	    
	    int a, b, a1, b1, a2, b2;
	    cin >> a >> b >> a1 >> b1>> a2 >> b2;
	    if(a1 == a || a1 == b){
    	    if(b1 == a || b1 == b){
	            cout << 1 << endl;
    	    }
	    }
	    else if(a2 == a || a2 == b){
	        if(b2 == a || b2 == b){
	            cout << 2 << endl;
	        }
	   } 
	   else{
	        cout << 0 << endl;
	    }
	    
	}
	return 0;
}

Problem Link: PROGLANG Problem - CodeChef

@nemolucky
Tried your code, its not calculating the last test cases in any number of test case. Does seems like an IDE issue, unless I have missed something.