/*
ALLAH IS THE GREATEST
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl "\n"
const ll Mod = 2e18+7;
const ll N = 1e5+7;
#define Subhanallah_Alhamdulillah_Allahu_Akbar ios_base::sync_with_stdio(false);cin.tie(NULL);
bool bs[10000007];
const ll sz = 1e6+5;
typedef pair<ll,ll>pi;
vector<ll>prime;
ll vis[N];
ll arr[N];
vector<ll>graph[N];
void sieve()
{
bs[0]=bs[1]=1;
for(ll i=3;i*i<=sz;i+=2)
{
if(!bs[i])
{
for(ll j=i*i;j<=sz;j+=i)
{
bs[j]=1;
}
}
}
prime.push_back(2);
for(ll i=3;i<=sz;i+=2)
{
if(!bs[i])
{
prime.push_back(i);
}
}
sort(prime.rbegin(),prime.rend());
}
ll mod(ll a, ll m){
return (a % m + m) % m;
}
ll biexpo(ll base,ll power)
{
ll ans =1;
while(power)
{
if(power%2==1)
{
ans=(ans*base);
power--;
}
else
{
base=(base*base);
power/=2;
}
}
return ans;
}
ll dfs(ll n)
{
vector<ll>v;
vis[n]=1;
stack<ll>st;
st.push(n);
while(!st.empty())
{
ll cur = st.top();
v.push_back(cur);
st.pop();
for(auto &i:graph[cur])
{
if(!vis[i])
{
st.push(i);
vis[i]=1;
}
}
}
ll mi = 1e18;
for(auto &k:v)
{
mi = min(mi,arr[k-1]);
}
return mi;
}
ll digsum(ll a)
{
ll sum=0;
while(a)
{
sum+=(a%10);
a/=10;
}
return sum;
}
int main()
{
//Think positively and move on
ll t;
cin>>t;
while(t--)
{
ll a,b,c;
cin>>a>>b>>c;
if(a==b && b==c)
{
cout<<0<<nl;
continue;
}
vector<ll>v;
map<ll,ll>mp;
v.push_back(a);
v.push_back(b);
v.push_back(c);
for(ll i=0;i<v.size();i++)
{
mp[v[i]]++;
}
ll mx = INT_MIN;
for(ll i=0;i<3;i++)
{
mx = max(mp[v[i]],mx);
}
if(mx==2)
{
cout<<1<<nl;
continue;
}
cout<<2<<nl;
}
return 0;
}