#include <bits/stdc++.h>
using namespace std;
int a[1010];
int book[1010];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    memset(book, 0, sizeof(book));
    int n, i, j;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      book[a[i]]++;
    }
    int ans = -99;
    int temp = 0;
    for (i = n; i >= 1; i--) {
      temp += book[i];
      if (book[i] >= i) {
        ans = max(ans, i);
      }
      {
        ans = max(min(temp, i), ans);
        continue;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
