#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define MAX 107
using namespace std;
int vote[MAX];
int t,n,a;
int main ( )
{
scanf ( "%d" , &t );
while ( t-- )
{
memset ( vote , 0 , sizeof( vote ) );
scanf ( "%d" , &n );
for ( int i = 0 ; i < n ; i++ )
{
scanf( "%d" , &a );
vote[a]++;
}
int ans = -1 , temp = 0;
for ( int i = 1 ; i <= n ; i++ )
if ( vote[i] > temp ) ans = i,temp = vote[i];
printf ( "%d\n" , ans );
}
}