Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 

Tweedle-Dee and Tweedle-Dum are in a fierce battle playing even-odd nim. This novel game is played on N heaps. Heap i contains a_{i} stones.

Like normal nim, Tweedle-Dee and Tweedle-Dum alternate taking a positive number of stones from any single one of the heaps, and the player that can't remove stones loses. However Tweedle-Dee can only take an even number of stones, and Tweedle-Dum can only take an odd number of stones.

Alice doesn't want to wait until the end of the game, so she asks you to determine the winner of the game. Remember that Tweedle-Dee and Tweedle-Dum are legendary grandmasters of combinatorial games, so they always play optimally.

------ 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 case consists of an integer N the number of heaps, and a string P the player that starts the game. String P is equal to "Dee" if Tweedle-Dee goes first, or "Dum" if  Tweedle-Dum goes first.
The second line of each case contains N space separated integers a_{i} the number of stones of the i-th heap.

------ Output ------ 

For each test case, output a single line containing either "Dee" if Twedle-Dee winns the game or "Dum" otherwise.

------ Constraints ------ 

$1 ≤ T ≤ 50$
$1 ≤ N ≤ 50$
$1 ≤ a_{i} ≤ 50$

----- Sample Input 1 ------ 
1
2 Dee
2 2
----- Sample Output 1 ------ 
Dum
----- explanation 1 ------ 
Tweedle-Dee takes two stones from any of the heaps leaving just one non empty heap, next Tweedle-Dum takes one stone and the game finishes.

Difficulty: MEDIUM
Tags: Game theory

Starter code:

Solutions:
tests = int(input())
for i in range(tests):
	(length, start) = input().split()
	arr = list(map(int, input().split()))
	if start == 'Dee' and int(length) == 1 and (arr[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	(n, p) = input().split()
	n = int(n)
	a = [int(j) for j in input().split()]
	if n == 1:
		if a[0] % 2 == 0 and p == 'Dee':
			print('Dee')
		else:
			print('Dum')
	else:
		print('Dum')


for _ in range(int(input())):
	(n, p) = input().split()
	n = int(n)
	l = list(map(int, input().split()))
	(even, odd) = (0, 0)
	for i in l:
		if i & 1 == 1:
			odd += 1
		else:
			even += 1
	diff = even - odd
	if n == 1:
		if l[0] % 2 == 0 and p == 'Dee':
			print('Dee')
		else:
			print('Dum')
	else:
		print('Dum')


T = int(input())
for i in range(T):
	(N, P) = input().split()
	ai = list(map(int, input().split()))
	if P == 'Dee' and int(N) == 1 and (ai[0] & 1 == 0):
		print('Dee')
	else:
		print('Dum')


t = int(input())
for _ in range(t):
	a = input().split()
	n = int(a[0])
	p = a[1]
	l = list(map(int, input().split()))
	if p == 'Dee':
		if n == 1 and l[0] % 2 == 0:
			print('Dee')
		else:
			print('Dum')
	else:
		print('Dum')


for tc in range(int(input())):
	(n, p) = map(str, input().split())
	n = int(n)
	a = list(map(int, input().split()))
	if n == 1 and p == 'Dee' and (a[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	l = [i for i in input().split()]
	arr = [int(i) for i in input().split()]
	if l[0] == '1' and arr[0] % 2 == 0 and (l[-1] == 'Dee'):
		print('Dee')
	else:
		print('Dum')


t = int(input())
for i in range(t):
	(n, s) = map(str, input().split())
	n = int(n)
	arr = list(map(int, input().split()))
	if len(arr) == 1 and arr[0] % 2 == 0 and (s == 'Dee'):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	ip = input().split()
	a = int(ip[0])
	str1 = str(ip[1])
	lis = list(map(int, input().split()))
	if str1 == 'Dee' and lis[0] % 2 == 0 and (a == 1):
		print('Dee')
	else:
		print('Dum')


T = int(input())
for tx in range(T):
	(Ns, P) = input().split()
	N = int(Ns)
	Ays = input().split()
	if P == 'Dee' and N == 1 and (int(Ays[0]) % 2 == 0):
		print('Dee')
	else:
		print('Dum')


try:
	from debug import debug, timer
except ImportError:
	pass
from sys import stdin
input = stdin.readline

def rii():
	return range(int(input().strip()))

def ii():
	return int(input().strip())

def mii():
	return map(int, input().strip().split(' '))

def lmii():
	return list(map(int, input().strip().split(' ')))

def si():
	return str(input().strip())

def getvals():
	while True:
		yield from input().split()

def tri(n):
	return n * (n + 1) // 2

def smallest_first(m, n):
	return (min(m, n), max(m, n))

def solve(*args):
	(n, p, a) = args
	return 'Dee' if all([n == 1, p == 'Dee', a[0] % 2 == 0]) else 'Dum'

def do_codechef():
	for t in rii():
		(n, p) = si().split(' ')
		n = int(n)
		a = lmii()
		print(solve(n, p, a))
do_codechef()
exit()


for _ in range(int(input())):
	(h, c) = input().split()
	h = int(h)
	arr = list(map(int, input().split()))
	if h == 1 and c == 'Dee' and (arr[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	(x, y) = map(str, input().split())
	arr = list(map(int, input().split()))
	var = int(x)
	if var == 1 and y == 'Dee' and (arr[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


T = int(input())
for _ in range(T):
	(n, s) = map(str, input().split())
	t = list(map(int, input().split()))
	n = int(n)
	if n == 1 and s == 'Dee' and (t[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


t = int(input())
for _ in range(t):
	(n1, s) = input().split(' ')
	arr = list(map(int, input().split(' ')))
	n = int(n1)
	if n == 1 and s == 'Dee' and (arr[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	(n, name) = map(str, input().split())
	n = int(n)
	arr = list(map(int, input().split()))
	if n == 1 and arr[0] % 2 == 0 and (name == 'Dee'):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	(n, p) = (i for i in input().split(' '))
	g = [int(i) for i in input().split(' ')]
	if len(g) == 1 and g[0] % 2 == 0 and (p == 'Dee'):
		print('Dee')
	else:
		print('Dum')


from math import *
import sys

def input():
	return sys.stdin.readline().replace('\n', '').strip()
sys.setrecursionlimit(10 ** 9)

def next_p(s):
	if s == 'Dee':
		return 'Dum'
	return 'Dee'
for _ in range(int(input())):
	(n, start) = input().split()
	n = int(n)
	l = list(map(int, input().split()))
	while True:
		if start == 'Dum':
			for pos in range(n):
				if l[pos] != 0 and l[pos] % 2 == 0:
					l[pos] = 1
					break
			else:
				for pos in range(n):
					if l[pos] != 0:
						l[pos] = 0
						break
				else:
					break
		else:
			for pos in range(n):
				if l[pos] != 0 and l[pos] >= 2:
					l[pos] = l[pos] % 2
					break
			else:
				break
		start = next_p(start)
	print(next_p(start))


for _ in range(int(input())):
	(n, s) = input().split()
	x = list(map(int, input().split()))
	if n == '1' and x[0] % 2 == 0 and (s == 'Dee'):
		print('Dee')
	else:
		print('Dum')


for i in range(int(input())):
	(n, p) = input().split()
	l = list(map(int, input().split()))
	if len(l) == 1 and sum(l) % 2 == 0 and (p == 'Dee'):
		print('Dee')
	else:
		print('Dum')


t = int(input())
for i in range(t):
	(n, p) = map(str, input().split())
	l = list(map(int, input().split()))
	if int(n) == 1:
		if l[0] % 2 == 1:
			print('Dum')
		elif p == 'Dee':
			print('Dee')
		else:
			print('Dum')
	else:
		print('Dum')


for _ in range(int(input())):
	(N, P) = map(str, input().split())
	A = list(map(int, input().split()))
	if int(N) == 1:
		if A[0] & 1:
			print('Dum')
		elif P == 'Dee':
			print('Dee')
		else:
			print('Dum')
	else:
		print('Dum')


for _ in range(int(input())):
	inp = input().split(' ')
	a = input().split(' ')
	if inp[0] == '1' and inp[1] == 'Dee' and (int(a[0]) % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	(n, s) = input().split()
	n = int(n)
	a = [int(i) for i in input().split()]
	if len(a) == 1 and sum(a) % 2 == 0 and (s == 'Dee'):
		print('Dee')
	else:
		print('Dum')


t = int(input())
for _ in range(t):
	(n, p) = map(str, input().split())
	l = list(map(int, input().split()))
	if len(l) == 1 and sum(l) % 2 == 0 and (p == 'Dee'):
		print('Dee')
	else:
		print('Dum')


T = int(input())
for i in range(T):
	(n, p) = input().split()
	stones = list(map(int, input().split()))
	if len(stones) == 1 and stones[0] % 2 == 0 and (p == 'Dee'):
		print('Dee')
	else:
		print('Dum')


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def solve():
	for _ in range(ii()):
		(n, p) = map(str, input().split())
		a = li()
		n = int(n)
		if n == 1 and a[0] % 2 == 0:
			if p == 'Dee':
				print('Dee')
			else:
				print('Dum')
		else:
			print('Dum')
solve()


t = int(input())
for _ in range(t):
	(n, p) = [x for x in input().split()]
	a = [int(x) for x in input().split()]
	if len(a) == 1 and a[0] % 2 == 0 and (p == 'Dee'):
		print('Dee')
	else:
		print('Dum')


for t in range(int(input())):
	(n, p) = (i for i in input().split(' '))
	game = [int(i) for i in input().split(' ')]
	if len(game) == 1 and game[0] % 2 == 0 and (p == 'Dee'):
		print('Dee')
	else:
		print('Dum')


T = int(input())
for _ in range(T):
	(n, s) = input().split()
	n = int(n)
	a = list(map(int, input().split()))
	if n > 1:
		print('Dum')
	elif n == 1 and s == 'Dee' and (a[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


t = int(input())
for T in range(t):
	(n, turn) = input().split()
	n = int(n)
	l = list(map(int, input().split()))
	if n > 1:
		print('Dum')
	elif n == 1 and l[0] % 2 == 0 and (turn == 'Dee'):
		print('Dee')
	else:
		print('Dum')


def deedum(n, p, arr):
	n = int(n)
	if n == 1 and p == 'Dee' and (arr[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')
	return
t = int(input())
for _ in range(t):
	(n, p) = map(str, input().split())
	arr = list(map(int, input().split()))
	deedum(n, p, arr)


for _ in range(int(input())):
	(K, P) = input().split()
	K = int(K)
	Heap = list(map(int, input().split()))
	if K == 1 and P == 'Dee' and (Heap[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	l1 = list(map(int, input().split()))
	if b == 'Dee' and a == 1 and (l1[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


T = int(input())
for i in range(T):
	(n, P) = input().split()
	N = int(n)
	a = list(map(int, input().split()))
	if P == 'Dee' and a[0] % 2 == 0 and (N == 1):
		print('Dee')
	else:
		print('Dum')
	T = T - 1


t = int(input())
for i in range(t):
	(n, c) = input().split()
	a = list(map(int, input().split()))
	n = int(n)
	if n == 1 and a[0] % 2 == 0 and (c == 'Dee'):
		print('Dee')
	else:
		print('Dum')


try:
	for j in range(int(input())):
		(n, s) = input().split()
		n = int(n)
		l = list(map(int, input().split()))
		if n == 1 and l[0] % 2 == 0 and (s == 'Dee'):
			print('Dee')
		else:
			print('Dum')
except:
	pass


import math
t = int(input())
for i in range(t):
	(n, s) = input().split()
	n = int(n)
	l = list(map(int, input().split()))
	if n == 1 and s == 'Dee' and (l[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for i in range(int(input())):
	(N, name) = input().split()
	N = int(N)
	list1 = list(map(int, input().split()))
	if N == 1 and name == 'Dee' and (list1[0] % 2 == 0):
		print('Dee')
	else:
		print('Dum')


for _ in range(int(input())):
	(i, j) = map(str, input().split())
	heaps = list(map(int, input().split()))
	if len(heaps) == 1 and heaps[0] % 2 == 0 and (j == 'Dee'):
		print('Dee')
	else:
		print('Dum')


t = int(input())
while t:
	(n, s) = input().split()
	n = int(n)
	a = [int(o) for o in input().split()]
	if n == 1 and a[0] % 2 == 0 and (s == 'Dee'):
		print('Dee')
	else:
		print('Dum')
	t -= 1