#include <bits/stdc++.h>
using namespace std;
#define int              long long int
#define double           long double


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int LINF = 2000000000000000001;


inline int power(int base, int exp) {
    int res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base)%M;
        base = (base * base);
        exp /= 2;
    }
    return res;
}


//_ ***************************** START Below *******************************

vector<int> a;
int count(int n, int mid){
    int ct = 0;
    for(int i=0; i<n; i++){
        if(a[i] <= mid) ct++;
    }
    return ct;
}




int consistency1(int n) {
    int s = 1;
    int e = n-1;
    int ans = 0;
    
    while(s<=e){
        int mid = s + (e-s)/2;
        if(count(n, mid) > mid) {
            ans = mid;
            e = mid-1;
        }
        else s = mid+1;
    }
    return ans;
}





int consistency2(int n){
    int s = 1, e = n-1;
    while(s<e){
        int mid = s + (e-s)/2;
        if(count(n, mid) > mid){
            e = mid;
        }
        else s = mid+1;
    }
    return e;
}












int practice(int n){
	
	
	
	
	return 0;
}


void solve() {

	int n;
	cin >> n;
	
	a.resize(n);
	for(int i=0; i<n; i++) cin >> a[i];
	
	cout << consistency1(n) << " " << consistency2(n) << endl;
	// cout << consistency1(n) << " -> " << practice(n) << endl;
	

}





int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	
    int t = 1;
	cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}