#include <bits/stdc++.h>
using namespace std;
long long int n, p, a[1111], i, j, ans, z, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> p;
  while (p) {
    cin >> n;
    for (i = 1; i <= n; ++i) {
      cin >> a[i];
    }
    sort(a + 1, a + 1 + n);
    j = 0;
    for (i = n; i >= 0; --i) {
      j++;
      if (j > a[i]) break;
    }
    cout << j - 1 << '\n';
    p--;
  }
  return false;
}
