#include <bits/stdc++.h>
using namespace std;
void pause() {}
bool sortbysecdesc(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second > b.second;
}
int rec(int n, int i, int a[], int c) {
  c++;
  if (n == i) return c;
  rec(a[n - 1], i, a, c);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, a[1005], c = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (int i = n - 1; i >= 0; i--) {
      c++;
      if (c == a[i]) {
        cout << c;
        break;
      } else if (c > a[i]) {
        cout << c - 1;
        break;
      }
    }
    cout << "\n";
  }
  pause();
}
