Problem name: link–> GRPASSN Problem - CodeChef
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner s=new Scanner(System.in);
long k=s.nextInt();
while(k-->0)
{
int a[]=new int[10];
int c=s.nextInt();
int flag=0;
while(c-- >0){
int n=s.nextInt();
a[n]++;
}
for (int i=0;i<=9;i++)
{
if(!(a[i]==0||a[i]==i))
{
System.out.println("NO");
flag=1;
break;
}
}
if(flag!=1)
System.out.println("YES");
}
}
}