#include <bits/stdc++.h>
using namespace std;
long long n, a[100000], max = 0, x, n2, p, j, nn, ans[100000];
int main() {
  ios::sync_with_stdio(false);
  cin >> nn;
  for (int ii = 1; ii <= nn; ii++) {
    cin >> n;
    n2 = n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (n2; n2 > 1; n2) {
      if (n2 % 2 == 0) {
        p = n2 / 2;
        if (a[p] > a[2 * p]) {
          x = a[p];
          a[p] = a[p * 2];
          a[p * 2] = x;
        }
        for (j = p - 1; j > 0; j--) {
          if (a[j] > a[j * 2 + 1]) {
            x = a[j];
            a[j] = a[j * 2 + 1];
            a[j * 2 + 1] = x;
          }
          if (a[j] > a[j * 2]) {
            x = a[j];
            a[j] = a[j * 2];
            a[j * 2] = x;
          }
        }
        x = a[1];
        a[1] = a[n2];
        a[n2] = x;
        n2--;
      } else {
        p = (n2 - 1) / 2;
        for (j = p; j > 0; j--) {
          if (a[j] > a[j * 2 + 1]) {
            x = a[j];
            a[j] = a[j * 2 + 1];
            a[j * 2 + 1] = x;
          }
          if (a[j] > a[j * 2]) {
            x = a[j];
            a[j] = a[j * 2];
            a[j * 2] = x;
          }
        }
        x = a[1];
        a[1] = a[n2];
        a[n2] = x;
        n2--;
      }
    }
    for (int i = n; i > 0; i--) {
      if (a[i] >= i) {
        ans[ii] = i;
        break;
      }
    }
    cout << ans[ii] << endl;
  }
  return 0;
}
