#include<bits/stdc++.h> using namespace std; int vis[10005],a[10005],t,n; int main(){ scanf("%d",&t); while(t--){ bool flag = true; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } memset(vis,0,sizeof(vis)); for(int i=1;i<=n;i++){ while(a[i]!=0&&(a[i]>n||vis[a[i]]==1)){ a[i]/=2; } if(a[i]==0){ flag=false; break; } vis[a[i]]=1; } if(flag) printf("YES\n"); else printf("NO\n"); } }