#include using namespace std; int te() { // read input int n; scanf("%d", &n); vector a(n); for(int i = 0; i < n; ++i) scanf("%d", &a[i]); // sort sort(a.begin(), a.end()); // check if some two numbers are equal for(int i = 0; i < (int) a.size() - 1; ++i) if(a[i] == a[i+1]) return a[i]; // check if the first (smallest) numbers are consecutive // if not then the smallest number should be removed if(a[0] + 1 != a[1]) return a[0]; return a.back(); // otherwise the biggest number } int main() { int T; scanf("%d", &T); while(T--) printf("%d\n", te()); }