#include<bits/stdc++.h>
using namespace std;
void work(double a,double b,double c){
if(a==0&&b==0||a==0&&c==0||b==0&&c==0) cout<<0<<endl;
else if(a==0||b==0||c==0){
if(a==b||a==c||b==c) cout<<1<<endl;
else cout<<2<<endl;
}
else{
double A=a/(a+b+c)*360,B=b/(a+b+c)*360,C=c/(a+b+c)*360;
if(A==180||B==180||C==180||a==b||a==c||b==c) cout<<2<<endl;
else cout<<3<<endl;
}
}
int main(){
int T;
double a,b,c;
cin>>T;
for(int i=1;i<=T;i++){
cin>>a>>b>>c;
work(a,b,c);
}
return 0;
}