Chef has just found a recipe book, where every dish consists of exactly four ingredients.
He is going to choose some two dishes and prepare them for dinner.
Of course, he likes diversity and wants to know whether the two dishes are similar.
Two dishes are called similar if at least half of their ingredients are the same.
In other words, at least two of four ingredients of the first dish should also be present in the second dish.
The order of ingredients doesn't matter.
Your task is to examine T pairs of dishes.
For each pair, check if the two dishes are similar and print "similar" or "dissimilar" accordingly.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.

The first line of each test case contains four distinct strings, denoting ingredients needed for the first dish.
Each ingredient is represented by a string of length between 2 and 10 inclusive, consisting of lowercase English letters.

The second line of each test case describes the second dish in the same format.

-----Output-----
For each test case, output a single line containing the answer — "similar" if at least half of the ingredients are same, and "dissimilar" otherwise (without the quotes).

-----Constraints-----
- 1 ≤ T ≤ 200
- The length of each string will be between 2 and 10 inclusive.

-----Example-----
Input:
5
eggs sugar flour salt
sugar eggs milk flour
aa ab ac ad
ac ad ae af
cookies sugar grass lemon
lemon meat chili wood
one two three four
one two three four
gibberish jibberish lalalalala popopopopo
jibberisz gibberisz popopopopu lalalalalu

Output:
similar
similar
dissimilar
similar
dissimilar

-----Explanation-----
Test case 1. The first dish consists of ingredients: eggs, sugar, flour, salt, while the second dish consists of: sugar, eggs, milk, flour. Three of four ingredients are present in both dishes (eggs, sugar, flour) so the two dishes are similar.
Test case 2. This example shows that strings in the input don't necessarily represent real food.
The answer is again "similar", because two ingredients are present in both dishes ("ac" and "ad").
Test case 3. The only common ingredient is lemon, so the answer is "dissimilar".
Remember that at least two ingredients should be present in both dishes.

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
t=int(input())
i=0
while i<t:
 a=[]
 a=input().split()
 b=[]
 b=input().split()
 j=0
 c=0
 while j<4:
  if a[j] in b:
   c+=1
  j+=1
 if c>=2:
  print("similar")
 else:
  print("dissimilar")
 i+=1

# cook your dish here
n=int(input())
l=[]
for i in range(0,n):
 s1=list(map(str,input().split()))
 s2=list(map(str,input().split()))
 count=0
 for j in range(len(s1)):
  if(s1[j] in s2):
   count+=1
 total=len(s1)/2
 if(count>=total):
  l.append("similar")
 else:
  l.append("dissimilar")
for i in l:
 print(i)

n=int(input())
l=[]
for i in range(0,n):
 s1=list(map(str,input().split()))
 s2=list(map(str,input().split()))
 count=0
 for j in range(len(s1)):
  if(s1[j] in s2):
   count+=1
 total=len(s1)/2
 if(count>=total):
  l.append("similar")
 else:
  l.append("dissimilar")
for i in l:
 print(i)

# cook your dish here
t=int(input())
for _ in range(t):
 s1=[]
 s2=[]
 c=0
 s1=list(input().split())
 s2=list(input().split())
 for i in range(len(s1)):
  if(s1[i] in s2):
   c=c+1
 if(c>=(len(s1)/2)):
  print("similar")
 else:
  print("dissimilar")


# cook your dish here
for _ in range(int(input())):
 l1=list(map(str,input().split()))
 l2=list(map(str,input().split()))
 c=0
 for i in l1:
  if i in l2:
   c=c+1 
 if c>=2:
  print('similar')
 else:
  print('dissimilar')

for _ in range(int(input())):
 s1=input().split()
 s2=input().split()
 count=0
 for i in s1:
  for j in s2:
   if i==j:
    count+=1
 if count>=2:
  print('similar')
 else:
  print('dissimilar')

# cook your dish here
t = int(input())
for i in range(t):
 a = list(input().split())
 b = list(input().split())
 count = 0
 for i in range(len(a)):
  for j in range(len(b)):
   if a[i]==b[j]:
    count = count + 1
 if count > 1:
  print('similar')
 else:
  print('dissimilar')


# cook your dish here
t = int(input())
while t:
 a = list(input().split())
 b = list(input().split())
 count = 0
 for i in range(len(a)):
  for j in range(len(b)):
   if a[i]==b[j]:
    count = count + 1
   
 if count > 1:
  print('similar')
 else:
  print('dissimilar')
 t = t-1


# cook your dish here
x = int(input())
for i in range(x):
 y = list(map(str, input().split()))[:4]
 z = list(map(str, input().split()))[:4]
 m = 0
 for j in range(4):
  for k in range(4):
   if y[j]==z[k]:
    m += 1
 if m>=2:
  print("similar")
 else:
  print("dissimilar")

t=int(input())
for _ in range (t):
 a = input().split()
 a = set(a)
 b = set(input().split())
 c = len(a&b)
 if c>=len(a)//2:
  print("similar")
 else:
  print("dissimilar")


# cook your dish here
for _ in range(int(input())):
 a = input().split()
 a = set(a)
 b = set(input().split())
 c = len(a&b)
 if c>=len(a)//2:
  print("similar")
 else:
  print("dissimilar")

n=int(input())
for i in range(0,n):
 l1=list(input().split())
 l2=list(input().split())
 l3=[]
 for item in l1:
  if(item in l2):
   l3.append(item)

 if(len(l3)>=2):
  print("similar")
 else:
  print("dissimilar")

# cook your dish here
n=int(input())
for i in range(0,n):
 c=0
 l1=list(map(str,input().split()))
 l2=list(map(str,input().split()))
 for x in l1:
  if x in l2:
   c=c+1
 if c>=2:
  print("similar")
 else:
  print("dissimilar")

for i in range(int(input())):
 l=[]
 l=input().split()
 k=[]
 k=input().split()
 k.sort()
 l.sort()
 c=0
 for j in l:
  for m in k:
   if j==m:
    c+=1
 if(c>=2):
  print('similar')
 else:
  print('dissimilar')

# cook your dish here
t=int(input())
def do():
 a=[d for d in input().split()]
 b=[e for e in input().split()]
 if len(set(a)&set(b))>=2:
  print('similar')
 else:
  print('dissimilar')
 return
for i in range(t):
 do()
 


for O in range(int(input())):
 l1=input().split()
 l2=input().split()
 s1=set(l1)
 s2=set(l2)
 s=set()
 s=s1.intersection(s2)
 if(len(s)>=2):
  print("similar")
 else:
  print("dissimilar")

# cook your dish here
t=int(input())
for i in range(t):
 s1=input().split()
 s2=input().split()
 c=0
 for i in s1:
  for j in s2:
   if i==j:
    c+=1 
 if c>=2:
  print("similar")
 else:
  print("dissimilar")

# cook your dish here
T=int(input())
for i in range(T):
 d1=list(input().split())
 d2=list(input().split())
 si=0
 for i in (d1):
  for j in (d2):
   if i==j:
    si=si+1
 if si>=2:
  print("similar")
 else:
  print("dissimilar")



t=int(input())
while t>0:
 s=input()
 l1=list(s.split(" ")) 
 s=input()
 l2=list(s.split(" "))
 l=len(l1) 
 l=l//2 
 c=fl=0
 for i in range(0,len(l1)):
  if l1[i] in l2:
   c+=1 
  if c==2:
   fl=1 
   break
 if fl==1:
  print("similar")
 else:
  print("dissimilar")
 t-=1

# cook your dish here
T=int(input())
for i in range(T):
 dish1=list(input().split())
 dish2=list(input().split())
 similar=0
 for i in (dish1):
  for j in (dish2):
   if i==j:
    similar=similar+1
 if similar>=2:
  print("similar")
 else:
  print("dissimilar")


t=int(input())
while t>0:
 str_1=set(input().split())
 str_2=set(input().split())
 if len(str_1.intersection(str_2)) >= 2:
  print("similar")
 else: 
  print("dissimilar")
 t -=1


# cook your dish here
for _ in range(int(input())):
 n=set(input().split())
 m=set(input().split())


 if len(n.intersection(m))>=2:
  print('similar')
 else:
  print('dissimilar')

# cook your dish here
t=int(input())
for ts in range(t):
 n=set(input().split())
 m=set(input().split())
 if len(n.intersection(m)) >= 2:
  print("similar")
 else: 
  print("dissimilar")

# cook your dish here
t=int(input())
for _ in range(t):
 a=set(input().split())
 b=set(input().split())
 if len(a.intersection(b)) >= 2:
  print("similar")
 else: 
  print("dissimilar")

t=int(input())
for i in range(t):
 a=input().split()
 b=input().split()
 c=0
 for i in a:
  if(i in b):
   c=c+1
 if(c>=2):
  print("similar")
 else:
  print("dissimilar")