# PROGLANG - Editorial

Author: Daanish Mahajan
Tester: Anay Karnik
Editorialist: Mohan Abhyas

Cakewalk

None

# PROBLEM:

Chef is a software developer, so he has to switch between different languages sometimes. Each programming language has some features, which are represented by integers here.

Currently, Chef has to use a language with two given features A and B. He has two options — switching to a language with two features A_1 and B_1, or to a language with two features A_2 and B_2. All four features of these two languages are pairwise distinct.

Tell Chef whether he can use the first language, the second language or neither of these languages (if no single language has all the required features).

# EXPLANATION:

Check if unordered pair (A,B) = any of unordered pairs (A_1,B_1) or (A_2,B_2) and answer accordingly

# TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

# SOLUTIONS:

[details = “Editorial’s Solution”]

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define forn(i,e) for(ll i = 0; i < e; i++)

void solve()
{
ll a,b,a1,b1,a2,b2;
cin>>a>>b>>a1>>b1>>a2>>b2;
if(a > b) swap(a,b);
if(a1 > b1) swap(a1,b1);
if(a2 > b2) swap(a2,b2);

if(a == a1 && b == b1)
{
cout<<1<<endl;
}
else if(a == a2 && b == b2)
{
cout<<2<<endl;
}
else
{
cout<<0<<endl;
}
}

int main()
{
ll t=1;
cin >> t;
forn(i,t) {
solve();
}
return 0;
}