using System.Collections.Generic;
static int ParseToInt(string input, ref int position)
for (; input[position] >= '0'; ++position)
retVal = retVal * 10 + input[position] - '0';
static Dictionary<long, byte> forbidden = new Dictionary<long, byte>(10000);
static long[] arr1 = new long[10000];
static byte[] arr2 = new byte[10000];
public static void Main()
string input = Console.In.ReadToEnd();
temp = ParseToInt(input, ref position);
for (int k = 0; k < temp; k++)
int numberCount = ParseToInt(input, ref position);
for (int i = 0; i != numberCount; ++i)
for (; input[position] >= '0'; ++position)
number = number * 10 + input[position] - '0';
length = position - length;
forbidden.Add(number, 0);
for (int i = 0 ; i != numberCount ; ++i)
for (int take = min; take <= arr2[i]; ++take)
number = (long) (number * 0.1);
if (forbidden.ContainsKey(number))
Console.WriteLine( invalid ? "NO" : "YES");