#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using i128 = __int128;
using ull = unsigned long long;
#define pll pair<ll, ll>
#define pii pair<int, int>
#define vi vector<int>
#define fir(i, a, b) for (int i = a; i <= b; i++)
#define pqi priority_queue<int> // 优先队列
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
vector<int> a(32);
for (int i = 0; i < 32; i++)
{
cin >> a[i];
}
sort(all(a));
int res = 1;
for (int i = 1; i < 32; i++)
{
if (a[0] > a[i])
res++;
}
if (p <= 2)
cout << 32 << "\n";
else if (p <= 6)
cout << 16 << "\n";
else if (p <= 13)
cout << 8 << "\n";
else if (p <= 27)
cout << 4 << "\n";
else if (p <= 31)
cout << 2 << "\n";
else
cout << 1 << "\n";
}
return 0;
}