#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define endl '\n'
using namespace std;
using ll =long long;
using pll=pair<ll,ll>;
const int mod=998244353;
ll ksm(ll a,ll b){
ll ans=1;
while(b){
if(b&1){
ans=(ans*a)%mod;
}
a=a*a%mod;
b>>=1;
}
return ans;
}
ll gcd(ll a,ll b){
ll t=a%b;
while(t){
a=b;b=t;t=a%b;
}
return b;
}
ll lcm(ll a,ll b){
return a/gcd(a,b)*b;
}
ll get_inv(ll x){
return ksm(x,mod-2);
}
const int N=5e5+10;
bool cmp(pair<ll,string>a,pair<ll,string>b){
if(a.x==b.x)return a.y<b.y;
return a.x>b.x;
}
ll a[40];
ll cnt[]{31,27,13,6,2,0};
void solve(){
// int n;
// cin>>n;
ll len=1;
for(int i=1;i<=32;i++){
cin>>a[i];
}
ll res=0;
for(int i=1;i<=32;i++){
if(a[i]<a[1])res++;
}
if()
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);
int _=1;
cin>>_;
while(_--)solve();
return 0;
}