There are $n$ logs, the $i$-th log has a length of $a_i$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.

errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $2$ pieces. If the length of the chosen log is $x$, and the lengths of the resulting pieces are $y$ and $z$, then $y$ and $z$ have to be positive integers, and $x=y+z$ must hold. For example, you can chop a log of length $3$ into logs of lengths $2$ and $1$, but not into logs of lengths $3$ and $0$, $2$ and $2$, or $1.5$ and $1.5$.

The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner?


-----Input-----

Each test contains multiple test cases. The first line contains a single integer $t$ ($1 \leq t \leq 100$)  — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($1 \leq n \leq 50$)  — the number of logs.

The second line of each test case contains $n$ integers $a_1,a_2, \ldots, a_n$ ($1 \leq a_i \leq 50$)  — the lengths of the logs.

Note that there is no bound on the sum of $n$ over all test cases.


-----Output-----

For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes).


-----Examples-----

Input
2
4
2 4 2 1
1
1
Output
errorgorn
maomao90


-----Note-----

In the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $4$ into $2$ logs of length $2$. After this there will only be $4$ logs of length $2$ and $1$ log of length $1$.

After this, the only move any player can do is to chop any log of length $2$ into $2$ logs of length $1$. After $4$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.

In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Game theory

Implementation


Solutions:
(e, m) = ('errorgorn', 'maomao90')
tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	total = sum(arr) - len(arr)
	if total % 2 == 0:
		print(m)
	else:
		print(e)


import math

def get_list():
	return list(map(int, input().split()))

def get_int():
	return int(input())

def out(output):
	if output:
		print('errorgorn')
	else:
		print('maomao90')
for i in range(get_int()):
	n = get_int()
	l = get_list()
	ans = 0
	out((sum(l) - len(l)) % 2 == 1)


def solve_one(n, nums):
	nums_sum = 0
	for l_el in nums:
		nums_sum += l_el - 1
	return 'errorgorn' if nums_sum % 2 == 1 else 'maomao90'

def solve():
	t = int(input())
	anss = []
	for _ in range(t):
		n = int(input())
		nums = map(int, input().split(' '))
		anss.append(solve_one(n, nums))
	for ans in anss:
		print(ans)
solve()


T = int(input())
for case in range(T):
	n = int(input())
	a = map(int, input().strip().split())
	total_actions = sum(a) - n
	if total_actions % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


def check(x, y):
	n = 0
	for i in y:
		k = i - 1
		n += k
	if n == 0:
		print('maomao90')
	elif n % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')
t = int(input())
for i in range(t):
	x = int(input())
	y = list(map(int, input().split()))
	check(x, y)


t = int(input())
for y in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	count = 0
	for i in l:
		count += i - 1
	if count % 2 != 0:
		print('errorgorn')
	else:
		print('maomao90')


for _ in range(int(input())):
	n = int(input())
	nums = [x for x in map(int, input().split()) if x > 1]
	even_count = sum((1 for x in nums if x % 2 == 0))
	if nums and even_count % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


t = int(input())
for _ in range(t):
	input()
	arr = [int(i) for i in input().split()]
	s = sum(arr) - len(arr)
	print(['errorgorn', 'maomao90'][1 - s & 1])


x = int(input())
for i in range(x):
	z = int(input())
	y = input().split(' ')
	s = -z
	for j in y:
		s += int(j)
	if s % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


import sys
amountCases = int(sys.stdin.readline())
for case in range(amountCases):
	amountLogs = int(sys.stdin.readline())
	logs = sys.stdin.readline().strip().split()
	chops = 0
	for log in range(amountLogs):
		chops += int(logs[log]) - 1
	if chops % 2 == 0:
		sys.stdout.write('maomao90\n')
	else:
		sys.stdout.write('errorgorn\n')


def even(arr):
	for i in arr:
		if i % 2 == 0:
			return True
	return False
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ref = []
	e = 0
	count = 0
	while even(arr):
		l = len(arr)
		for i in range(l):
			if arr[i] % 2 == 0:
				count += 1
				ref.append(arr[i] // 2)
				ref.append(arr[i] // 2)
		arr = [] + ref
		ref = []
	if count & 1:
		print('errorgorn')
	else:
		print('maomao90')


t = int(input(''))
for z in range(t):
	n = int(input(''))
	a = list(map(int, input('').split()))[:n]
	s = 0
	for i in a:
		if i != 1:
			s += i - 1
	if s % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	total = sum(b) - a
	if total % 2:
		print('errorgorn')
	else:
		print('maomao90')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if (sum(a) - n) % 2 != 0:
		print('errorgorn')
	else:
		print('maomao90')


t = int(input())
for i in range(t):
	sum = 0
	n = int(input())
	a = list(map(int, input().strip().split()))
	for i in range(len(a)):
		sum = sum + a[i]
		sum1 = sum - n
	if sum == 1:
		print('maomao90')
	elif sum1 % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())

def solve(a):
	sum = 0
	for e in a:
		sum += e - 1
	if sum % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')
for _ in range(t):
	n = int(input())
	a = map(int, input().split(' '))
	solve(a)


T = int(input())
for cid in range(T):
	N = int(input())
	R = sum(map(int, input().split())) - N
	if R % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


n = int(input())
mass = 0
k = 0
for nabor in range(n):
	nabor = int(input())
	b = range(nabor)
	b = map(int, input().split())
	for a in b:
		mass += a
		k += 1
	mass -= k
	if mass % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')
	mass = 0
	k = 0


t = int(input())
winlist = []
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	summ = 0
	for i in a:
		if i != 1:
			summ += i - 1
	if (summ - 1) % 2 == 0:
		winlist.append('errorgorn')
	else:
		winlist.append('maomao90')
for i in winlist:
	print(i)


t = int(input())
for i in range(t):
	input()
	lst = list(map(int, input().split()))
	if len([i for i in lst if not i % 2]) % 2:
		print('errorgorn')
	else:
		print('maomao90')


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	arr = [int(x) for x in input().split()]
	s = sum(arr) - n
	if s % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')

def get_print_int_same(x):
	sys.stdout.write(str(x) + ' ')

def get_print_same(x):
	sys.stdout.write(x + ' ')

def solve():
	for _ in range(get_int()):
		n = get_int()
		arr = get_list()
		summ = 0
		for i in range(n):
			summ += arr[i] - 1
		if summ % 2:
			get_print('errorgorn')
		else:
			get_print('maomao90')
solve()


test_cases = input()
arr = []
arr2 = []
for i in range(int(test_cases)):
	arr2.append(input().split())
	arr.append(list(map(int, input().split())))
for e in arr:
	tern = sum(e) - len(e)
	if tern == 0:
		print('maomao90')
	elif tern % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


test = int(input())
for t in range(test):
	even = 0
	n = int(input())
	array = list(map(int, input().split()))
	for i in range(0, len(array)):
		if array[i] % 2 == 0:
			even = even + 1
	if even % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
for i in range(t):
	n = int(input())
	logs = list(map(int, input().split()))
	chopspossible = 0
	i = 0
	while i < n:
		l = logs[i]
		chopspossible = chopspossible + l - 1
		i += 1
	if chopspossible % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


for n in [*open(0)][2::2]:
	print(('maomao90', 'errorgorn')[sum([int(i) - 1 for i in n.split()]) % 2])


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	print('errorgorn' if (sum(ar) - n) % 2 == 1 else 'maomao90')


for i in range(int(input())):
	n = int(input())
	ans = sum([int(x) % 2 == 0 and int(x) != 1 for x in input().split()])
	if ans % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
for i in range(t):
	n = int(input())
	lengths_of_logs = input().split(' ')
	for i in range(n):
		lengths_of_logs[i] = int(lengths_of_logs[i])
	chopping_logs = []
	for log in lengths_of_logs:
		if log != 1:
			chopping_logs.append(log)
	result = sum(chopping_logs) - len(chopping_logs)
	if result % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for _ in range(int(input())):
	n = inp()
	arr = inlt()
	sumer = sum(arr) - n
	if sumer % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


import collections
import math
import sys

def main():
	n = int(input())
	a = list(map(int, input().split()))
	m = 0
	for x in a:
		if x > 1:
			m += x - 1
	if m % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')
t = int(input())
while t > 0:
	main()
	t -= 1


import sys

def solve():
	inp = sys.stdin.readline
	n = int(inp())
	c = 0
	for i in map(int, inp().split()):
		c += max(i - 1, 0)
	print('errorgorn' if c % 2 else 'maomao90')

def main():
	for i in range(int(sys.stdin.readline())):
		solve()
main()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	if (s - n) % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


import sys
for i in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	ans = 0
	a = list(map(int, sys.stdin.readline().split()))
	for i in range(n):
		ans += a[i] - 1
	if ans % 2:
		print('errorgorn')
	else:
		print('maomao90')


t = int(input())

def solve(n, lst):
	n_t = 0
	for i in lst:
		n_t += i - 1
	if n_t % 2 == 1:
		return 'errorgorn'
	else:
		return 'maomao90'
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))


for tc in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = sum(arr) - n
	if cnt % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = sum(a) - len(a)
	if p % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = 0
	for j in range(n):
		s = s + a[j] - 1
	if s % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		ans += a[i] - 1
	if ans % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


x = int(input())
for i in range(x):
	n = int(input())
	s = input()
	arr = [int(l) for l in s.split(' ')]
	su = 0
	for j in arr:
		su += j - 1
	if su % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	c = 0
	for j in lst:
		c += j - 1
	if c % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	ct = 0
	for i in range(n):
		ct += a[i] - 1
	if ct % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


import math
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [x for x in a if x != 1]
	test = sum(b) - len(b)
	if test % 2 != 0 and test != 0:
		print('errorgorn')
	else:
		print('maomao90')


for _ in range(int(input())):
	n = int(input())
	summ = 0
	numbers = input().split()
	for i in numbers:
		summ += int(i)
	if (summ - n) % 2:
		print('errorgorn')
	else:
		print('maomao90')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	x = s - n
	if x % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


n = int(input())
out = []
for i in range(n):
	m = int(input())
	l = [int(i) for i in input().split()]
	x = 0
	for i in l:
		x += i
	x -= m
	if x % 2 == 0:
		out.append('maomao90')
	else:
		out.append('errorgorn')
for i in out:
	print(i)


for _ in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	c = 0
	for i in range(n):
		c = c + ls[i] - 1
	if c == 0 or c % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


import sys
input = sys.stdin.readline

def LI():
	return list(map(int, input().split()))
t = int(input())
for i in range(t):
	n = int(input())
	a = LI()
	tmp = 0
	for i in range(n):
		tmp += a[i] - 1
	if tmp % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


def solve():
	count = 0
	for i in range(n):
		count += arr[i] - 1
	if count % 2:
		return 'errorgorn'
	return 'maomao90'
T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = solve()
	print(ans)


t = int(input())
for _ in range(0, t):
	n = int(input())
	list1 = [int(num) for num in input().split()]
	cuttings = 0
	for i in range(0, len(list1)):
		cuttings += list1[i] - 1
	if cuttings % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


for t in range(int(input())):
	input()
	arr = list(map(int, input().split()))
	cuts = 0
	for i in arr:
		cuts += i - 1
	if cuts % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


for _ in range(int(input())):
	n = int(input())
	a = sum([int(i) - 1 for i in input().split() if int(i) > 1])
	print('errorgorn' if a % 2 == 1 else 'maomao90')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = 0
	for i in arr:
		cnt += i - 1
	if cnt % 2:
		print('errorgorn')
	else:
		print('maomao90')


for _ in range(int(input())):
	x = int(input())
	y = list(map(int, input().split()))
	z = sum(y)
	sid = z - len(y)
	a = sid % 2
	if a == 0:
		print('maomao90')
	else:
		print('errorgorn')


for _ in range(int(input())):
	b = int(input())
	c = list(map(int, input().split()))
	k = 0
	for i in c:
		k += i - 1
	if k % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


m = int(input())
for i in range(m):
	n = int(input())
	a = [int(i) for i in input().split()]
	if (sum(a) - n) % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(str(input()).split(' '))
	arr = [int(x) for x in arr]
	arr.sort()
	flag = 0
	arr = arr[::-1]
	if n == 1:
		if arr[0] >= 2:
			if arr[0] % 2 == 0:
				print('errorgorn')
			else:
				print('maomao90')
			continue
		else:
			print('maomao90')
			continue
	else:
		sum = 0
		for el in arr:
			sum += el
		sum -= n
		if sum % 2 == 0:
			print('maomao90')
		else:
			print('errorgorn')


import math
for i in range(int(input())):
	n = int(input())
	A = [int(k) for k in input().split()]
	if (sum(A) - n) % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


def solve(a):
	sum = 0
	for i in a:
		sum += i - 1
	if sum % 2 == 0:
		return 'maomao90'
	else:
		return 'errorgorn'
t = int(input())
for i in range(1, t + 1):
	n = int(input())
	a = [int(a) for a in input().split(' ')]
	print(solve(a))


t = int(input())
for _ in range(t):
	n = int(input())
	s = sum(map(int, input().split())) - n
	print('errorgorn' if s % 2 else 'maomao90')


def nood(l):
	count = 0
	for i in l:
		if i % 2 == 1:
			count += 1
	return count
t = int(input())
for u in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(len(a)):
		a[i] = a[i] - 1
	y = sum(a)
	if y % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = sum(l)
	n = m - n
	if n & 1:
		print('errorgorn')
	else:
		print('maomao90')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [x for x in a if x % 2 == 0]
	aa = len(b)
	if aa % 2 != 0:
		print('errorgorn')
	else:
		print('maomao90')


tests = int(input())
for _ in range(tests):
	n = int(input())
	lis = list(map(int, input().split()))
	s = sum(lis)
	if (s + n) % 2 == 1:
		print('errorgorn')
	else:
		print('maomao90')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	odd = 0
	ev = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			ev += 1
		else:
			odd += 1
	if ev % 2 != 0:
		print('errorgorn')
		return
	else:
		print('maomao90')
		return
for ii in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	print(('maomao90', 'errorgorn')[(sum(a) - n) % 2])


import sys
sys.setrecursionlimit(10000)

def read_line(f):
	while True:
		s = f.readline().strip()
		if s:
			return s

def read_list(f):
	return [int(x) for x in read_line(f).split()]

def read_tuple(f):
	return tuple(read_list(f))

def load_single_case(f):
	read_line(f)
	return read_list(f)

def load_cases(f):
	n = int(f.readline())
	cases = []
	for _ in range(n):
		yield load_single_case(f)
	return cases

def solve(case):
	return (sum(case) - len(case) + 1) % 2

def outcome_string(outcome):
	return 'errorgorn' if outcome == 0 else 'maomao90'

def save_outcomes(f, outcomes):
	for (n, o) in enumerate(outcomes):
		f.write('{}\n'.format(outcome_string(o)))

def process(path_in=None, path_out=None):
	if path_out is None and path_in is not None:
		path_out = path_in.rsplit('.', 1)[0] + '.out'
	f_in = open(path_in) if path_in else sys.stdin
	f_out = open(path_out, 'w') if path_out else sys.stdout
	try:
		outcomes = [solve(c) for c in load_cases(f_in)]
		save_outcomes(f_out, outcomes)
	finally:
		if path_in:
			f_in.close()
		if path_out:
			f_out.close()
process()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = sum(l) - len(l)
	if ans % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


def logChopping(A):
	count = 0
	for k in range(len(A)):
		count += A[k] - 1
	if count % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')
t = int(input())
for i in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	logChopping(A)


t = int(input())
loser = []
for th in range(t):
	n = int(input())
	length = input()
	length1 = length.split()
	result = 0
	for i in length1:
		result = result + int(i) - 1
	if result % 2 == 0:
		loser.append('maomao90')
	else:
		loser.append('errorgorn')
for name in loser:
	print(name)


test = int(input())
for i in range(test):
	n = int(input())
	lengths = [int(a) for a in str(input()).split(' ')]
	count = sum(lengths) - len(lengths)
	if count % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	count = 0
	for i in arr:
		if i == 1:
			continue
		else:
			count += i - 1
	if count == 0:
		print('maomao90')
	elif count % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	p = sum(arr) - n
	if p % 2:
		print('errorgorn')
	else:
		print('maomao90')


def case(n):
	x = int(input())
	l = list(map(int, input().split()))
	cnt = 0
	for i in l:
		if i > 1:
			cnt += i - 1
	if cnt % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')
x = int(input())
for i in range(1, x + 1):
	case(i)


for t in range(int(input())):
	n = int(input())
	inp = list(map(int, input().split()))
	sum = 0
	for i in inp:
		sum += i
	if (sum - n) % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


for _ in range(int(input())):
	x = int(input())
	y = sum(list(map(int, input().split())))
	if (y - x) % 2 == 0:
		print('maomao90')
	else:
		print('errorgorn')


t = int(input())
while t:
	n = int(input())
	a = [int(i) for i in input().split()]
	count1 = 0
	for i in range(len(a)):
		count1 = count1 + (a[i] - 1)
	if count1 % 2 != 0:
		print('errorgorn')
	else:
		print('maomao90')
	t = t - 1