Kicker (table football) is a board game based on football, in which players control the footballers' figures mounted on rods by using bars to get the ball into the opponent's goal. When playing two on two, one player of each team controls the goalkeeper and the full-backs (plays defence), the other player controls the half-backs and forwards (plays attack).

Two teams of company Q decided to battle each other. Let's enumerate players from both teams by integers from 1 to 4. The first and second player play in the first team, the third and the fourth one play in the second team. For each of the four players we know their game skills in defence and attack. The defence skill of the i-th player is a_{i}, the attack skill is b_{i}.

Before the game, the teams determine how they will play. First the players of the first team decide who will play in the attack, and who will play in the defence. Then the second team players do the same, based on the choice of their opponents.

We will define a team's defence as the defence skill of player of the team who plays defence. Similarly, a team's attack is the attack skill of the player of the team who plays attack. We assume that one team is guaranteed to beat the other one, if its defence is strictly greater than the opponent's attack and its attack is strictly greater than the opponent's defence.

The teams of company Q know each other's strengths and therefore arrange their teams optimally. Identify the team that is guaranteed to win (if both teams act optimally) or tell that there is no such team.


-----Input-----

The input contain the players' description in four lines. The i-th line contains two space-separated integers a_{i} and b_{i} (1 ≤ a_{i}, b_{i} ≤ 100) — the defence and the attack skill of the i-th player, correspondingly.


-----Output-----

If the first team can win, print phrase "Team 1" (without the quotes), if the second team can win, print phrase "Team 2" (without the quotes). If no of the teams can definitely win, print "Draw" (without the quotes).


-----Examples-----
Input
1 100
100 1
99 99
99 99

Output
Team 1

Input
1 1
2 2
3 3
2 2

Output
Team 2

Input
3 3
2 2
1 1
2 2

Output
Draw



-----Note-----

Let consider the first test sample. The first team can definitely win if it will choose the following arrangement: the first player plays attack, the second player plays defence.

Consider the second sample. The order of the choosing roles for players makes sense in this sample. As the members of the first team choose first, the members of the second team can beat them (because they know the exact defence value and attack value of the first team).

Difficulty: MEDIUM_HARD
Tags: Implementation

Starter code:

Solutions:
def _win(a, b, c, d):
	if a[0] > c[1] and b[1] > d[0]:
		return 1
	elif a[0] < c[1] and b[1] < d[0]:
		return -1
	else:
		return 0

def win(a, b, c, d):
	global p
	return _win(p[a], p[b], p[c], p[d])

def win_comb(a, b, c, d):
	(x, y) = (win(a, b, c, d), win(a, b, d, c))
	if x == 1 and y == 1:
		return 1
	if x == -1 or y == -1:
		return -1
	return 0

def win_team1(a, b, c, d):
	(x, y) = (win_comb(a, b, c, d), win_comb(b, a, c, d))
	if x == 1 or y == 1:
		return 1
	if x == -1 and y == -1:
		return -1
	return 0
p = []
for i in range(4):
	p.append(tuple(map(int, input().split())))
w = win_team1(0, 1, 2, 3)
if w == 1:
	print('Team 1')
elif w == -1:
	print('Team 2')
else:
	print('Draw')


a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
c = tuple(map(int, input().split()))
d = tuple(map(int, input().split()))

def check(el1, el2):
	if el1[0][0] > el2[1][1] and el1[1][1] > el2[0][0]:
		return 1
	if el2[0][0] > el1[1][1] and el2[1][1] > el1[0][0]:
		return 2
	return 0

def check2(el):
	ans = 5
	cd = [(c, d), (d, c)]
	for el2 in cd:
		if check(el, el2) == 2:
			return 2
		ans = min(ans, check(el, el2))
	return ans

def main():
	ans = 5
	aw = [(a, b), (b, a)]
	for el in aw:
		if check2(el) == 1:
			return print('Team 1')
		ans = min(ans, check2(el))
	if ans == 0:
		print('Draw')
	else:
		print('Team 2')
main()


x = [tuple((int(i) for i in input().split())) for j in range(4)]
if x[0][0] + x[1][1] > x[0][1] + x[1][0]:
	t1atk = x[1][1]
	t1def = x[0][0]
else:
	t1atk = x[0][1]
	t1def = x[1][0]

def f():
	if t1atk > t2def and t1def > t2atk:
		return 0
	elif t1atk < t2def and t1def < t2atk:
		return 2
	else:
		return 1
t2def = x[2][0]
t2atk = x[3][1]
a = f()
t2def = x[3][0]
t2atk = x[2][1]
b = f()
if a > b:
	t2def = x[2][0]
	t2atk = x[3][1]
else:
	t2def = x[3][0]
	t2atk = x[2][1]
if t1atk > t2def and t1def > t2atk:
	print('Team 1')
elif t1atk < t2def and t1def < t2atk:
	print('Team 2')
else:
	print('Draw')


def f():
	(a, b) = list(map(int, input().split()))
	(A, B) = list(map(int, input().split()))
	return ((a, B), (A, b))

def g(u, v):
	return u[0] > v[1] and u[1] > v[0]
(x, y) = (f(), f())
if any((all((g(j, i) for i in y)) for j in x)):
	print('Team 1')
elif all((any((g(i, j) for i in y)) for j in x)):
	print('Team 2')
else:
	print('Draw')


mtr = [[1, 0], [0, 1]]
p1 = list(map(int, input().split()))
p2 = list(map(int, input().split()))
p3 = list(map(int, input().split()))
p4 = list(map(int, input().split()))
w1 = w2 = 0
for l1 in mtr:
	wi1 = wi2 = 0
	for l2 in mtr:
		at1 = p1[1] if l1[0] == 1 else p2[1]
		z1 = p1[0] if l1[0] == 0 else p2[0]
		at2 = p3[1] if l2[0] == 1 else p4[1]
		z2 = p3[0] if l2[0] == 0 else p4[0]
		if at1 > z2 and z1 > at2:
			wi1 += 1
		elif at1 < z2 and z1 < at2:
			wi2 += 1
	if wi2 >= 1:
		w2 += 1
	elif wi1 == 2:
		w1 += 1
if w2 == 2:
	print('Team 2')
elif w1 >= 1:
	print('Team 1')
else:
	print('Draw')


def get_tuple():
	(a, A) = list(map(int, input().split()))
	(b, B) = list(map(int, input().split()))
	return ((a, B), (b, A))

def larger(a1, a2):
	return a1[0] > a2[1] and a1[1] > a2[0]

def smaller(a1, a2):
	return a1[0] < a2[1] and a1[1] < a2[0]
(t11, t12) = get_tuple()
(t21, t22) = get_tuple()
if larger(t11, t21) and larger(t11, t22):
	print('Team 1')
elif larger(t12, t21) and larger(t12, t22):
	print('Team 1')
elif (smaller(t11, t21) or smaller(t11, t22)) and (smaller(t12, t21) or smaller(t12, t22)):
	print('Team 2')
else:
	print('Draw')


(d1, a1) = map(int, input().split())
(d2, a2) = map(int, input().split())
(d3, a3) = map(int, input().split())
(d4, a4) = map(int, input().split())
if (d1 > a3 and a2 > d4) and (d1 > a4 and a2 > d3) or (d2 > a3 and a1 > d4 and (d2 > a4) and (a1 > d3)):
	print('Team 1')
elif (d1 < a3 and a2 < d4 or (d1 < a4 and a2 < d3)) and (d2 < a3 and a1 < d4 or (d2 < a4 and a1 < d3)):
	print('Team 2')
else:
	print('Draw')


(a, b) = list(map(int, input().split()))
(c, d) = list(map(int, input().split()))
(x, y) = list(map(int, input().split()))
(z, w) = list(map(int, input().split()))
Team1 = False
Team2 = False
if a > w and a > y and (d > x) and (d > z):
	Team1 = True
if c > w and c > y and (b > x) and (b > z):
	Team1 = True
if (x > b and w > c or (z > b and y > c)) and (x > d and w > a or (z > d and y > a)):
	Team2 = True
if Team1:
	print('Team 1')
elif Team2:
	print('Team 2')
else:
	print('Draw')


p1 = input().split(' ')
p2 = input().split(' ')
p3 = input().split(' ')
p4 = input().split(' ')
version11 = int(p1[0]) > int(p3[1]) and int(p2[1]) > int(p4[0])
version12 = int(p1[0]) > int(p4[1]) and int(p2[1]) > int(p3[0])
version21 = int(p2[0]) > int(p3[1]) and int(p1[1]) > int(p4[0])
version22 = int(p2[0]) > int(p4[1]) and int(p1[1]) > int(p3[0])
version112 = int(p1[0]) < int(p3[1]) and int(p2[1]) < int(p4[0])
version122 = int(p1[0]) < int(p4[1]) and int(p2[1]) < int(p3[0])
version212 = int(p2[0]) < int(p3[1]) and int(p1[1]) < int(p4[0])
version222 = int(p2[0]) < int(p4[1]) and int(p1[1]) < int(p3[0])
if version11 and version12 or (version21 and version22):
	print('Team 1')
elif (version112 or version122) and (version212 or version222):
	print('Team 2')
else:
	print('Draw')


def find_winer(defence1, attack1, defence2, attack2):
	if defence1[0] > attack2[1] and attack1[1] > defence2[0]:
		return 1
	elif defence1[0] < attack2[1] and attack1[1] < defence2[0]:
		return 2
	else:
		return 0

def find_results(players):
	results = []
	results.append(find_winer(players[0], players[1], players[2], players[3]))
	results.append(find_winer(players[0], players[1], players[3], players[2]))
	results.append(find_winer(players[1], players[0], players[2], players[3]))
	results.append(find_winer(players[1], players[0], players[3], players[2]))
	return results

def solve():
	players = []
	for i in range(4):
		players.append(tuple(map(int, input().split())))
	results = find_results(players)
	if results[0] == 1 and results[1] == 1 or (results[2] == 1 and results[3] == 1):
		print('Team 1')
	elif (results[0] == 2 or results[1] == 2) and (results[2] == 2 or results[3] == 2):
		print('Team 2')
	else:
		print('Draw')
solve()


A = [[int(j) for j in input().split()] for i in range(4)]
check1 = A[0][0] > A[2][1] and A[1][1] > A[3][0] and (A[0][0] > A[3][1]) and (A[1][1] > A[2][0])
check2 = A[1][0] > A[2][1] and A[0][1] > A[3][0] and (A[1][0] > A[3][1]) and (A[0][1] > A[2][0])
check3 = A[2][0] > A[0][1] and A[3][1] > A[1][0] or (A[3][0] > A[0][1] and A[2][1] > A[1][0])
check4 = A[2][0] > A[1][1] and A[3][1] > A[0][0] or (A[3][0] > A[1][1] and A[2][1] > A[0][0])
if check1 or check2:
	print('Team 1')
elif check3 and check4:
	print('Team 2')
else:
	print('Draw')


def check(a1, b1, a2, b2):
	if b1 > a2 and a1 > b2:
		return True
	return False

def solve(x):
	if check(x[0][0], x[1][1], x[2][0], x[3][1]) and check(x[0][0], x[1][1], x[3][0], x[2][1]) or (check(x[1][0], x[0][1], x[2][0], x[3][1]) and check(x[1][0], x[0][1], x[3][0], x[2][1])):
		return 1
	if (check(x[3][0], x[2][1], x[0][0], x[1][1]) or check(x[2][0], x[3][1], x[0][0], x[1][1])) and (check(x[3][0], x[2][1], x[1][0], x[0][1]) or check(x[2][0], x[3][1], x[1][0], x[0][1])):
		return 2
	return 0

def main():
	x = []
	for i in range(4):
		tmp = list(map(int, input().split()))
		x.append(tmp)
	w = solve(x)
	if w == 0:
		print('Draw')
	else:
		print('Team {}'.format(w))
main()


p1 = list(map(int, input().split()))
p2 = list(map(int, input().split()))
p3 = list(map(int, input().split()))
p4 = list(map(int, input().split()))
t1 = [(p1[0], p2[1]), (p2[0], p1[1])]
score = [0, 0]
t2 = [(p3[0], p4[1]), (p4[0], p3[1])]
t11 = t1[0]
t12 = t1[1]
t21 = t2[0]
t22 = t2[1]
if t11[0] > t21[1] and t11[0] > t22[1] and (t11[1] > t21[0]) and (t11[1] > t22[0]):
	print('Team 1')
elif t12[0] > t21[1] and t12[0] > t22[1] and (t12[1] > t21[0]) and (t12[1] > t22[0]):
	print('Team 1')
elif (t11[0] < t21[1] and t11[1] < t21[0] or (t11[0] < t22[1] and t11[1] < t22[0])) and (t12[0] < t21[1] and t12[1] < t21[0] or (t12[0] < t22[1] and t12[1] < t22[0])):
	print('Team 2')
else:
	print('Draw')


def win(a, b, c, d):
	if a > d and b > c:
		return 1
	return 0
a = {}
b = {}
for i in range(2):
	(a[i * 2], b[i * 2]) = map(int, input('').split())
	(a[1 + i * 2], b[1 + i * 2]) = map(int, input('').split())
	h = b[i * 2]
	b[i * 2] = b[1 + i * 2]
	b[1 + i * 2] = h
if win(a[0], b[0], a[2], b[2]) * win(a[0], b[0], a[3], b[3]) == 1 or win(a[1], b[1], a[2], b[2]) * win(a[1], b[1], a[3], b[3]) == 1:
	print('Team 1')
	exit()
if win(a[2], b[2], a[0], b[0]) * win(a[2], b[2], a[1], b[1]) == 1 or win(a[3], b[3], a[0], b[0]) * win(a[3], b[3], a[1], b[1]) == 1 or win(a[2], b[2], a[0], b[0]) * win(a[3], b[3], a[1], b[1]) == 1 or (win(a[2], b[2], a[1], b[1]) * win(a[3], b[3], a[0], b[0]) == 1):
	print('Team 2')
	exit()
print('Draw')


(a1, d1) = [int(a) for a in input().split()]
(a2, d2) = [int(a) for a in input().split()]
(a3, d3) = [int(a) for a in input().split()]
(a4, d4) = [int(a) for a in input().split()]
team1win = False
for (A1, D1) in [(a1, d2), (a2, d1)]:
	good = True
	for (A2, D2) in [(a3, d4), (a4, d3)]:
		if A1 <= D2 or D1 <= A2:
			good = False
	if good:
		team1win = True
team2win = True
for (A1, D1) in [(a1, d2), (a2, d1)]:
	good = False
	for (A2, D2) in [(a3, d4), (a4, d3)]:
		if D2 > A1 and A2 > D1:
			good = True
	if not good:
		team2win = False
if team1win:
	print('Team 1')
elif team2win:
	print('Team 2')
else:
	print('Draw')


def play(t1, t2):
	r = 0
	if t1[0] > t2[1] and t1[1] > t2[0]:
		r = 1
	elif t1[0] < t2[1] and t1[1] < t2[0]:
		r = -1
	else:
		r = 0
	return r
p = []
m = []
res = []
for _ in range(4):
	(a, b) = map(int, input().split(' '))
	p.append((a, b))
m.append((p[0][0], p[1][1]))
m.append((p[1][0], p[0][1]))
m.append((p[2][0], p[3][1]))
m.append((p[3][0], p[2][1]))
res.append((play(m[0], m[2]), play(m[0], m[3])))
res.append((play(m[1], m[2]), play(m[1], m[3])))
mm = max([max(i) for i in res])
res = [i for i in res if max(i) == mm]
res = [min(i) for i in res]
if 1 in res:
	rr = 2
else:
	rr = max(res) + 1
ss = ['Team 2', 'Draw', 'Team 1']
print(ss[rr])


def check(a, b, c, d):
	if a > d and b > c:
		return 1
	return 0
a = [0 for i in range(4)]
b = [0 for i in range(4)]
for i in range(4):
	(a[i], b[i]) = map(int, input().split())
if check(a[0], b[1], a[2], b[3]) and check(a[0], b[1], a[3], b[2]):
	print('Team 1')
elif check(a[1], b[0], a[2], b[3]) and check(a[1], b[0], a[3], b[2]):
	print('Team 1')
elif (check(a[2], b[3], a[0], b[1]) or check(a[3], b[2], a[0], b[1])) and (check(a[3], b[2], a[1], b[0]) or check(a[2], b[3], a[1], b[0])):
	print('Team 2')
else:
	print('Draw')


(team1, team2) = (lambda t: [[list(map(int, input().split())) for x in range(2)] for y in range(2)])('input')
if (lambda t1, t2: any((all((t1[x][0] > t2[y][1] and t1[1 - x][1] > t2[1 - y][0] for y in range(2))) for x in range(2))))(team1, team2):
	print('Team 1')
elif (lambda t1, t2: all((any((t2[y][0] > t1[x][1] and t2[1 - y][1] > t1[1 - x][0] for y in range(2))) for x in range(2))))(team1, team2):
	print('Team 2')
else:
	print('Draw')


def main():
	M = [0] * 4
	for i in range(4):
		M[i] = list(map(int, input().split()))
	W = [[0] * 2 for i in range(2)]
	for i in range(0, 2):
		for j in range(2, 4):
			if M[i][0] > M[j][1] and M[i ^ 1][1] > M[j ^ 1][0]:
				W[i][j - 2] = 1
			elif M[i][0] < M[j][1] and M[i ^ 1][1] < M[j ^ 1][0]:
				W[i][j - 2] = -1
			else:
				W[i][j - 2] = 0
	if max(W[0][0] + W[0][1], W[1][0] + W[1][1]) == 2:
		print('Team 1')
	elif min(W[0][0], W[0][1]) + min(W[1][0], W[1][1]) == -2:
		print('Team 2')
	else:
		print('Draw')
main()


import sys
read = lambda : list(map(int, sys.stdin.readline().split()))
(a0, d0) = read()
(a1, d1) = read()
(a2, d2) = read()
(a3, d3) = read()
w02 = a0 > d3 and d1 > a2
w03 = a0 > d2 and d1 > a3
w12 = a1 > d3 and d0 > a2
w13 = a1 > d2 and d0 > a3
w20 = a2 > d1 and d3 > a0
w21 = a2 > d0 and d3 > a1
w30 = a3 > d1 and d2 > a0
w31 = a3 > d0 and d2 > a1
if w02 and w03 or (w12 and w13):
	print('Team 1')
elif (w20 or w30) and (w21 or w31):
	print('Team 2')
else:
	print('Draw')


p11 = list(map(int, input().split()))
p12 = list(map(int, input().split()))
p21 = list(map(int, input().split()))
p22 = list(map(int, input().split()))

def f(a, b, c, d):
	if a[0] > d[1] and b[1] > c[0]:
		return 1
	if a[0] < d[1] and b[1] < c[0]:
		return 2
	return 0
c1 = f(p11, p12, p21, p22)
c2 = f(p12, p11, p21, p22)
c3 = f(p11, p12, p22, p21)
c4 = f(p12, p11, p22, p21)
if (c1 == 2 or c3 == 2) and (c2 == 2 or c4 == 2):
	print('Team 2')
elif c1 == 1 and c3 == 1 or (c2 == 1 and c4 == 1):
	print('Team 1')
else:
	print('Draw')