include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
const int N=200010;
int a[N],cnt[N];
int main()
{
int t;
cin>>t;
while(t–){
int n;
cin>>n;
memset(cnt,0,(n+1)*4);
int res=-1;
for(int i=0;i[HTML_REMOVED]>a[i];
cnt[a[i]];
}
for(int i=0;i[HTML_REMOVED]a[i])
res=i;
}
}
if(res !=-1)res;
cout<<res<<endl;
}
}