#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,n) for(ll i=0;i<n;i++)
#define m(a,b,c) max(a,max(b,c))
#define N ll n;cin >> n;
#define Nk ll n,k;cin >> n >> k;
#define A ll a[n];f(i,n) cin >> a[i];
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr);
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define S string s;cin>>s;
#define pb push_back
int main()
{
FAST_IO;
ll t;
cin>>t;
while(t--)
{
N;
A;
ll c[n+1]={0};
f(i,n)
{
if(a[i]<n+1)
{
c[a[i]]++;
}
}
ll u=1;
for(ll i=1;i<=n;i++)
{
if(c[i]==0)
{
u=0;
NO;
break;
}
}
if(u)
{
YES;
}
}
return 0;
}