#include<iostream>
#include<climits>
#define ll long long
#include<vector>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
void solve()
{
ll a, b, a1, b1, a2, b2;
cin >> a >> b >> a1 >> b1 >> a2 >> b2;
ll cnt1 = 0, cnt2 = 0;
if (a == a1 || a == b1)
cnt1++;
if (b == a2 || b == b2)
cnt2++;
if (cnt1 > 0 && cnt2 == 0)
cout << 1 << "
";
else if (cnt2 > 0 && cnt1 == 0)
cout << 2 << "
";
else
cout << 0 << "
";
}
int main()
{
int t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
#include<iostream>
#include<climits>
#define ll long long
#include<vector>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
void solve()
{
ll a, b, a1, b1, a2, b2;
cin >> a >> b >> a1 >> b1 >> a2 >> b2;
ll cnt1 = 0, cnt2 = 0;
if (a == a1 || a == b1)
cnt1++;
if (b == a2 || b == b2)
cnt2++;
if (cnt1 > 0 && cnt2 == 0)
cout << 1 << "
";
else if (cnt2 > 0 && cnt1 == 0)
cout << 2 << "
";
else
cout << 0 << "
";
}
int main()
{
int t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
#include<iostream>
#include<climits>
#define ll long long
#include<vector>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
void solve()
{
ll a, b, a1, b1, a2, b2;
cin >> a >> b >> a1 >> b1 >> a2 >> b2;
ll cnt1 = 0, cnt2 = 0;
if (a == a1 || a == b1)
cnt1++;
if (b == a2 || b == b2)
cnt2++;
if (cnt1 > 0 && cnt2 == 0)
cout << 1 << "
";
else if (cnt2 > 0 && cnt1 == 0)
cout << 2 << "
";
else
cout << 0 << "
";
}
int main()
{
int t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}