#include<bits/stdc++.h>
using namespace std;
#define ll long long
void fastcode(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main(){
fastcode();
int tt;
cin >> tt;
while(tt--){
int n;
cin >> n;
int arr[n];
for(int i = 0 ; i < n ; i++){
cin >> arr[i];
}
int max = 0 ;
for (int i = 0 ; i < n ; i++){
if(max < arr[i]){
max = arr[i];
}
}
for (int i = 0 ; i < n ; i++){
if(arr[i] == max){
cout << max<< " ";
}
}
cout << endl;
}
}