Tweedle-Dee and Tweedle-Dum are playing a fierce match of binary Nim. This novel game is played with $N$ stacks, each of them containing only $1$-s and $0$-s.
Just like in normal Nim, Tweedle-Dee and Tweedle-Dum alternate turns; in their turn, a player must choose one non-empty stack and remove a positive number of elements from the top of this stack. However, Tweedle-Dee may only choose a stack with $0$ at the top (and remove elements from it afterwards), and similarly, Tweedle-Dum may only choose a stack with $1$ at the top. the player that cannot make a move loses
Suzumo does not want to wait for the end of the game, so given the starting player he asks you to determine the winner. Remember that Tweedle-Dee and Tweedle-Dum are legendary grandmasters of combinatorial games, so both always play optimally.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains an integer $N$, a string $S$ denoting the number of stacks, the player that starts the game, respectively.
- Each of the following $N$ lines contains a single binary string $B$ representing a stack; the first character of $B$ corresponds to the top element of the stack and the last character to the bottom element.

-----Output-----
For each test case, print a single line containing the string "Dee" if Tweedle-Dee wins the match or "Dum" if Tweedle-Dum wins.

-----Constraints-----
- $1 \le T \le 500$
- $1 \le N \le 50$
- $1 \le |B| \le 50$
- each character in $B$ is either '1' or '0'
- $S$ is either "Dee" or "Dum"

-----Example Input-----
2
2 Dee
101
010
2 Dum
101
010

-----Example Output-----
Dum
Dee

Difficulty: interview

Starter code:

Solutions:
for u in range(int(input())):
 p=input().split()
 n=int(p[0])
 s=p[1]
 x,y=0,0
 for i in range(n):
  l=input()
  if(l[0]=='1'):
   y+=l.count('1')
  else:
   x+=l.count('0')
 if(x<y):
  print("Dum")
 elif(y<x):
  print("Dee")
 else:
  if(s=='Dee'):
   print("Dum")
  else:
   print("Dee")


for _ in range(int(input())):
 temp = list(input().split())
 n = int(temp[0])
 s = temp[1]
 du,de = 0,0
 for _ in range(n):
  mc = input()
  if mc[0] == '1':
   du+=mc.count('1')
  else:
   de+=mc.count('0')
 if de>du:
  print("Dee")
 elif de<du:
  print("Dum")
 else:
  if s == "Dee":
   print("Dum")
  else:
   print("Dee")

# cook your dish here
t = int(input())
for _ in range(t):
 arr = input().split()
 i1,j1 = 0,0
 for _ in range(int(arr[0])):
  s = str(input())
  if(s[0] == '0'):
   i1+=s.count('0')
  else:
   j1+=s.count('1') 
 if(i1 == j1):
  if(arr[1] == "Dee"):
   print("Dum")
  else:
   print("Dee")
 elif(i1>j1):
  print("Dee")
 else:
  print("Dum")
  
  


t=int(input())
for _ in range(t):
 countDee=0
 countDum=0
 n,s=input().split(maxsplit=1)
 n=int(n)
 s=str(s)
 for i in range(n):
  b=str(input())
  if b[0]=='0':
   countDee+=b.count('0')
  else:
   countDum+=b.count('1')
 if countDee>countDum:
  print("Dee")
 elif countDee==countDum:
  if 'Dee' in s:
   print("Dum")
  else:
   print("Dee")
 else:
  print("Dum")
   
  


for i in range(int(input())):
 a,string=input().split()
 # print(a,string)
 zero=0
 one=0 
 for j in range(0,int(a)):
  k=input()
  if(k[0]=='1'):
   one+=k.count("1") 
  else:
   zero+=k.count("0")
 # print(one,zero)
 if(string=='Dum'):
  if(one>zero):
   print('Dum')
  else:
   print('Dee')
 else:
  if(zero>one):
   print('Dee')
  else:
   print('Dum')


# cook your dish here
t=int(input())
for i in range(t):
 a,b=list(input().split())
 l=[]
 for i in range(int(a)):
  l.append(input())
 #print(l)
 r=0
 r1=0
 for i in range(len(l)):
  if l[i][0]=="0":
   r+=l[i].count("0")
  else:
   r1+=l[i].count("1")
 if b=="Dee":
  if r>r1:
   print("Dee")
  else:
   print("Dum")
 else:
  if r1>r:
   print("Dum")
  else:
   print("Dee")


# cook your dish here
for _ in range(int(input())):
 n,s = input().split()
 n = int(n)
 b = []
 for i in range(n):
  b.append(input())
 
 zero = 0
 one = 0
 for i in range(n):
  if b[i][0] =='0':
   zero += b[i].count('0')
  else:
   one += b[i].count('1')
 
 if s=='Dee':
  if zero > one:
   print("Dee")
  else:
   print("Dum")
 else:
  if one > zero:
   print("Dum")
  else:
   print("Dee")


# cook your dish here
t=int(input())

while t:
 n, s=input().split()
 n=int(n)
 Deec=0
 Dumc=0
 b=[] #Dee starts with 0; Dum starts with 1
 for _ in range(n):
  x = input()
  if x[0]=='0':
   for i in x:
    if i=='0':
     Deec+=1
  if x[0]=='1':
   for i in x:
    if i=='1':
     Dumc+=1
     
 if s=="Dee": 
  if Deec>Dumc:
   print("Dee")
  else:
   print("Dum")
 
 else:
  if Dumc>Deec:
   print("Dum")
  else:
   print("Dee")
  
 t-=1

# cook your dish here
for _ in range(int(input())):
 n,t=input().split()
 n=int(n)
 one=0
 zero=0
 for i in range(n):
  s=input()
  if s[0]=='1':
   one+=s.count("1")
  else:
   zero+=s.count("0")
 
 if(one>zero):
  print("Dum")
 elif(one<zero):
  print("Dee")
 else:
  if(t=="Dee"):
   print("Dum")
  else:
   print("Dee")
  
 
   
   


# cook your dish here
for _ in range(int(input())):
 s=input().split()
 n=int(s[0])
 s1=s[1]
 a,b=0,0
 for i in range(n):
  x=input()
  if(x[0]=='0'):
   k0=x.count('0')
   a+=k0
  else:
   k1=x.count('1')
   b+=k1
 if(a==b):
  if(s1=="Dee"):
   print("Dum")
  else:
   print("Dee")
 else:
  if(a>b):
   print("Dee")
  else:
   print("Dum")

def main():
 t = int(input())
 for _ in range(t):
  [n, s] = list(input().split())
  n = int(n)
  one, zero = 0, 0
  for i in range(n):
   s1 = input()
   if s1[0] == '0':
    zero += s1.count('0')
   else:
    one += s1.count('1')
  if zero > one:
   print('Dee')
  elif zero < one:
   print('Dum')
  else:
   if s == 'Dee':
    print('Dum')
   else:
    print('Dee')

def __starting_point():
 main()


__starting_point()

# cook your dish here

t = int(input())

for _ in range(t):
 n,s = list(map(str,input().split()))
 n = int(n)
 count1,count2 = 0,0
 for i in range(n):
  k = input()
  if k[0] == '0':
   count1+=k.count('0')
  elif k[0] == '1':
   count2+=k.count('1')
 
 if count1 == count2:
  if s == 'Dee':
   print('Dum')

  else:
   print('Dee')

 elif count1>count2:
  print('Dee')

 else:
  print('Dum')


t = int(input())
for i in range(t):
 dee = 0
 dum = 0
 [n, start] = input().split(' ')
 n=int(n)
 #print(n,starter)
 for k in range(n):
  pile = input()
  if pile[0] == '0':
   dee += pile.count('0')
  else:
   dum += pile.count('1')
 if start == 'Dum':
  if dum>dee:
   print('Dum')
  else:
   print('Dee')
 else:
  if dum<dee:
   print('Dee')
  else:
   print('Dum')

t = int(input())

while t:
 t-=1
 deeCount = 0
 dooCount = 0
 [n, starter] = input().split(' ')
 n=int(n)
 #print(n,starter)
 while n:
  n-=1
  stack = input()
  if stack[0] == '0':
   deeCount += stack.count('0')
  else:
   dooCount += stack.count('1')
 #print(deeCount, dooCount)
 if starter == 'Dum':
  if dooCount>deeCount:
   print('Dum')
  else:
   print('Dee')
 else:
  if dooCount<deeCount:
   print('Dee')
  else:
   print('Dum')

for _ in range(int(input())):
 a,b=input().split()
 a=int(a)
 onec=0
 zeroc=0
 for i in range(a):
  stk=input()
  if stk[0]=='0':
   zeroc+=stk.count('0')
  else:
   onec+=stk.count('1')
 if b=='Dee':
  if zeroc>onec:
   print('Dee')
  else:
   print('Dum')
 else:
  if onec>zeroc:
   print('Dum')
  else:
   print('Dee')

t = int(input())
for _ in range(t):
 n, s = input().split()
 c = [0, s == 'Dee']
 for _ in range(int(n)):
  b = input()
  c[b[0] == '1'] += b.count(b[0])
 print(('Dee', 'Dum')[c[0] < c[1]])


t = int(input())
for _ in range(t):
 n, s = input().split()
 n = int(n)
 c = [0, s == 'Dee']
 for _ in range(n):
  b = input()
  c[b[0] == '1'] += b.count(b[0])
 print(('Dee', 'Dum')[c[0] < c[1]])


t = int(input())
for _ in range(t):
 n, s = input().split()
 n = int(n)
 c = [0, 0]
 for _ in range(n):
  b = input()
  c[b[0] == '1'] += b.count(b[0])
 print(('Dee', 'Dum')[c[0] == c[1] and s == 'Dee' or c[0] < c[1]])


t = int(input())
names = 'Dee', 'Dum'
for _ in range(t):
 n, s = input().split()
 n = int(n)
 c = [0, 0]
 for _ in range(n):
  b = input()
  c[b[0] == '1'] += b.count(b[0])
 print(names[c[0] == c[1] and s == 'Dee' or c[0] < c[1]])


t = int(input())
names = 'Dee', 'Dum'
for _ in range(t):
 n, s = input().split()
 n = int(n)
 c = [0, 0]
 for _ in range(n):
  b = list(map(int, input()))
  c[b[0]] += b.count(b[0])
 print(names[c[0] == c[1] and s == 'Dee' or c[0] < c[1]])


t = int(input())
names = 'Dee', 'Dum'
for _ in range(t):
 n, s = input().split()
 n = int(n)
 s = names.index(s)
 c = [0, 0]
 for _ in range(n):
  b = list(map(int, input()))
  c[b[0]] += b.count(b[0])
 print(names[c[0] == c[1] and s == 0 or c[0] < c[1]])


t = int(input())
names = 'Dee', 'Dum'
for _ in range(t):
 n, s = input().split()
 n = int(n)
 s = names.index(s)
 c = [0, 0]
 for _ in range(n):
  b = list(map(int, input()))
  c[b[0]] += b.count(b[0])
 print(names[c[0] == c[1] and s ^ 1 or c[0] < c[1]])


#https://www.codechef.com/problems/BINIM

#https://www.youtube.com/watch?v=w6l_tDniL34&feature=youtu.be

t=int(input())

while t!=0:
 t-=1
 temp=input().split()
 p1="Dee" #0
 p2="Dum" #1
 start=temp[1]
 if(start==p1):
  start=0
 else:
  start=1
 n=int(temp[0])

 l=[]
 for i in range(n):
  s=input()
  s=list(s)[::-1] #stack
  s=[int(x) for x in s]
  l.append(s)
 
 
 
 
 while True:
  finished=False
  for s in l:
   done=False
   if(s): 
    if(s[-1]==start):
     s.pop() 
     done=True
     finished=True
    else:
     continue
    
   while(s): #playing optimally and taking control of the stack by                 removing other player's elements
    if(s[-1]!=start):
     s.pop() 
     done=True
     finished=True
    else:
     break
   if(done):
    break

  if(not finished):
   break
  start=1-start

 if(start==0):
  print("Dum") #whoever couldn't finish, loses in this problem
 else:
  print("Dee")




for t in range(int(input())):
 n,m=[x for x in input().split()]
 a=int(n)
 n0,n1=0,0
 for i in range (a):
  s=input()
  z=s[0]
  if(z=='0'):
   n0+=1
  else:
   n1+=1
  for i in range(1,len(s)):
   if (s[i]==s[0]):
    if (s[i]=='0'):
     n0 += 1
    if(s[i]=='1'):
     n1 += 1
 if(n0 == n1):
  if m=="Dee":print("Dum")
  if m=="Dum":print("Dee")
 if(n0>n1):print("Dee")
 if(n1>n0):print("Dum")