#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int T, t[4];
int cmp (int x, int y) {
return x > y;
}
int main () {
// freopen ("cake.in", "r", stdin);
// freopen ("cake.out", "w", stdout);
scanf ("%d", &T);
while (T --) {
scanf ("%d%d%d", &t[1], &t[2], &t[3]);
sort (t + 1, t + 1 + 3, cmp);
int a = t[1], b = t[2], c = t[3];
if (b == c && c == 0) printf ("0\n");
else if (c == 0) {
if (a == b) printf ("1\n");
else printf ("2\n");
}
else {
int s = a + b + c;
a = 360 / s * a;
b = 360 / s * b;
c = 360 / s * c;
if (a > 180) {
if (b == c) printf ("2\n");
printf ("3\n");
}
else if (a == 180) printf ("2\n");
else {
if (b == c) printf ("2\n");
else printf ("3\n");
}
}
}
return 0;
}
/*
6
0 0 8
0 5 3
9 9 0
6 2 4
1 7 4
5 8 5
*/