Chef wants to serve mankind by making people immortal by preparing a dish, a dish of life - a dish with the best taste in the universe, one with the smell and splash of fresh water flowing down the springs of the mountain, one with the smell of the best lily flowers of the garden, one that has contained the very essence of life in a real sense. 
This dish will contain K ingredients that are found only in remote islands amid mountains. For sake of convenience, we enumerate the ingredients by the integers from 1 to K, both inclusive. There are N islands and each of them offers some ingredients. Chef being a little child did not know how to collect the ingredients for the recipe. He went to all the islands and bought all the ingredients offered in each island. Could he possibly have saved some time by skipping some island? If it was not possible for Chef to collect the required ingredients (i.e. all the K ingredients), output "sad". If it was possible for him to skip some islands, output "some", otherwise output "all".

-----Input-----
First line of the input contains an integer T denoting number of test cases. The description of T test cases follow.
The first line of each test case contains two space separated integers N, K.
The i-th of the next lines will contain first an integer Pi, denoting the number of ingredients grown in the i-th island, followed by Pi distinct integers in the range [1, K]. All the integers are space separated. 

-----Output-----
For each test case, output a single line containing one of the strings "sad", "all" or "some" (without quotes) according to the situation. 

-----Constraints-----
- 1 ≤ T  ≤ 10
- 1 ≤ N, K ≤ 105
- 1 ≤ Pi ≤ K
- Sum of Pi over all test cases ≤ 106

-----Subtasks-----
Subtask #1 (30 points)
- 1 ≤ N, K ≤ 50

Subtask #2 (30 points)
- 1 ≤ K ≤ 50

Subtask #3 (40 points)
- original constraints

-----Example-----
Input
3
3 4
3 1 2 3
2 1 3
2 1 2
2 3
3 1 2 3
2 1 3
2 3
2 1 2
2 1 3

Output
sad
some
all

-----Explanation-----
Example 1. The ingredient 4 is not available in any island, so Chef can't make the dish of life. Hence, the answer is "sad".
Example 2. Chef can just go to the first island and collect all the three ingredients required. He does not need to visit the second island. So, the answer is "some".
Example 3. Chef has to visit both the islands in order to obtain all the three ingredients. So, the answer is "all".

Difficulty: interview

Starter code:

Solutions:
for _ in range(int(input())):
 n,k = list(map(int,input().split()))
 array = []
 tot = []
 for _ in range(n):
  temp = list(map(int,input().split()))
  aa = temp[0]
  del(temp[0])
  temp.sort()
  temp.insert(0,aa)
  array.append(temp)
 dic = {}
 array.sort(reverse=True)
 for i in array:
  del(i[0])
 for i in range(1,k+1):
  dic[i] = False
 count = 0
 for i in array:
  count += 1
  # print(count,tot)
  for j in i:
   if(dic[j]==True):
    pass
   else:
    tot.append(j)
    dic[j]=True
  if(len(tot)==k):
   break
 if(len(tot)!=k):
  print("sad")
 elif(count!=n):
  print("some")
 else:
  print("all")

for _ in range(int(input())):
 n,k = list(map(int,input().split()))
 array = []
 tot = []
 for _ in range(n):
  temp = list(map(int,input().split()))
  aa = temp[0]
  del(temp[0])
  temp.sort()
  temp.insert(0,aa)
  array.append(temp)
 dic = {}
 array.sort(reverse=True)
 for i in array:
  del(i[0])
 for i in range(1,k+1):
  tot.append(i)
  dic[i] = False
 count = 0
 for i in array:
  count += 1
  # print(count,tot)
  for j in i:
   if(dic[j]==True):
    pass
   else:
    tot.remove(j)
    dic[j]=True
  if(len(tot)==0):
   break
 if(len(tot)!=0):
  print("sad")
 elif(count!=n):
  print("some")
 else:
  print("all")

for _ in range(int(input())):
 n,k = list(map(int,input().split()))
 array = []
 tot = []
 for _ in range(n):
  temp = list(map(int,input().split()))
  aa = temp[0]
  del(temp[0])
  temp.sort()
  temp.insert(0,aa)
  array.append(temp)
 array.sort(reverse=True)
 for i in array:
  del(i[0])
 for i in range(1,k+1):
  tot.append(i)
 count = 0
 for i in array:
  count += 1
  # print(count,tot)
  for j in i:
   if(j in tot):
    tot.remove(j)
  if(len(tot)==0):
   break
 if(len(tot)!=0):
  print("sad")
 elif(count!=n):
  print("some")
 else:
  print("all")

for q in range(int(input())):
 n,k=list(map(int,input().split()))
 test=[]
 z=[]
 f=0
 for i in range(n):
  l=[int(i) for i in input().split()]
  l=l[1:]
  z.append(l)
 c=[0]*(k+1)
 for i in range(n):
  for j in z[i]:
   c[j]+=1
 for i in range(1,k+1):
  if c[i]==0:
   print("sad")
   f=1
   break
 if f==1:
  continue
 for i in range(n):
  cnt=0
  for j in z[i]:
   if c[j]!=1:
    cnt+=1
  if cnt==len(z[i]):
   print("some")
   break
 else:
  print("all")
   
    
   



#island=[[0 for i in range(k+2)]for j in range(n)
for _ in range(int(input())):
 island=[]
 n,k=map(int,input().split())
 for i in range(n):
  l=[int(i) for i in input().split()]
  l=l[1:]
  island.append(l)
 cnt=[0]*(k+1)
 for i in range(n):
  for indigrient in island[i]:
   cnt[indigrient]+=1 
 f=1 
 for i in range(1,k+1):
  if cnt[i]==0:
   f=0 
   break 
 if not f:
  print('sad')
  continue 
 f1=0 
 # print(island)
 for i in range(n):
  f2=1 
  for j in island[i]:
   if cnt[j]==1:
    f2=0
  if f2:
   f1=1 
   break 
 if f1:
  print('some')
 else:
  print('all')