import java.util.Scanner;
class Solution {
public static void main(String args[]) throws Exception {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int testCase = 1; testCase <= T; testCase++) {
int t = sc.nextInt();
int[] arr = new int[101];
for (int i = 0; i < 1000; i++) {
int temp = sc.nextInt();
arr[temp]++;
}
int max = 0;
int result = 0;
for (int i = 0; i < 101; i++) {
if (max <= arr[i]) {
max = arr[i];
result = i;
}
}
System.out.printf("#%d %d\n", t, result);
}
}
}
크기 101의 배열 arr를 선언해 각 점수대의 인원수를 체크하고 arr의 최대값 인덱스를 출력한다.