AtCoder Beginner Contest 110 - 1 Dimensional World's Tale

Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.
The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.
One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.
If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.
 - X < Z \leq Y
 - x_1, x_2, ..., x_N < Z
 - y_1, y_2, ..., y_M \geq Z
Determine if war will break out.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N, M \leq 100
 - -100 \leq X < Y \leq 100
 - -100 \leq x_i, y_i \leq 100
 - x_1, x_2, ..., x_N \neq X
 - x_i are all different.
 - y_1, y_2, ..., y_M \neq Y
 - y_i are all different.

-----Input-----
Input is given from Standard Input in the following format:
N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M

-----Output-----
If war will break out, print War; otherwise, print No War.

-----Sample Input-----
3 2 10 20
8 15 13
16 22

-----Sample Output-----
No War

The choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.
 - X = 10 < 16 \leq 20 = Y
 - 8, 15, 13 < 16
 - 16, 22 \geq 16

Source: atcoder | Difficulty: EASY


Solutions:
(n, m, x, y) = map(int, input().split())
xm = list(map(int, input().split()))
ym = list(map(int, input().split()))
print('No War' if max([x] + xm) < min([y] + ym) else 'War')


(n, m, x, y) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print('No War' if max(a) < min(b) and x < min(b) <= y else 'War')


(N, M, X, Y) = map(int, input().split())
x = max(X, max(list(map(int, input().split()))))
y = min(Y, min(list(map(int, input().split()))))
if y > x:
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
X = sorted(list(map(int, input().split())) + [x])[-1]
Y = sorted(list(map(int, input().split())) + [y])[0]
print('No War' if Y - X >= 1 else 'War')


(N, M, X, Y) = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
if X <= x[-1] and x[-1] < y[0] and (y[0] <= Y):
	print('No War')
else:
	print('War')


(n, m, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
print('No War' if max([X] + x) < min([Y] + y) else 'War')


(N, M, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = sorted(x, reverse=True)
y = sorted(y)
ANS = []
ans = x[0] + 1
while True:
	if ans <= y[0]:
		ANS.append(ans)
		ans = ans + 1
	else:
		break
for i in ANS:
	if X < i:
		if i < Y:
			print('No War')
			return
print('War')


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	(N, M, x, y) = list(map(int, readline().split()))
	X = list(map(int, readline().split()))
	Y = list(map(int, readline().split()))
	X.append(x)
	Y.append(y)
	if max(X) < min(Y):
		print('No War')
	else:
		print('War')
	return

def __starting_point():
	main()
__starting_point()


(n, m, x, y) = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
isWar = True
z = min(y_list)
if x < z <= y and max(x_list) < z:
	isWar = False
if isWar:
	print('War')
else:
	print('No War')


(N, M, X, Y) = map(int, input().split())
Zx = max(map(int, input().split()))
Zy = min(map(int, input().split()))
if X < Zy and Zy <= Y and (Zx < Zy):
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
max_x = max(list(map(int, input().split())))
min_y = min(list(map(int, input().split())))
for z in range(x + 1, y + 1):
	if max_x < z <= min_y:
		print('No War')
		return
else:
	print('War')


(n, m, x, y) = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
x = max(x, max(xl))
y = min(y, min(yl))
print('No War' if y > x else 'War')


(N, M, X, Y) = list(map(int, input().split()))
xM = max([X] + list(map(int, input().split())))
ym = min([Y] + list(map(int, input().split())))
if xM < ym:
	print('No War')
else:
	print('War')


(n, m, x, y, *l) = map(int, open(0).read().split())
print((max(x, *l[:n]) < min(y, *l[n:])) * 'No ' + 'War')


import math
(N, M, X, Y) = map(int, input().split())
x = max(map(int, input().split()))
y = min(map(int, input().split()))
print('No War' if x < y and x < Y and (X < y) else 'War')


(n, m, x, y) = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
xs.sort()
ys.sort()
if x >= y:
	print('War')
else:
	for i in range(x + 1, y + 1):
		if i > xs[-1] and i <= ys[0]:
			print('No War')
			return
		else:
			ans = 'War'
print(ans)


(n, m, x, y) = map(int, input().split())
xi = [int(_) for _ in input().split()] + [x]
yi = [int(_) for _ in input().split()] + [y]
print('War' if max(xi) >= min(yi) else 'No War')


(n, m, X, Y) = map(int, input().split())
k = list(map(int, input().split(' ')))
j = list(map(int, input().split(' ')))
print(['', 'No '][max(X, max(k)) < min(min(j), Y)] + 'War')


import sys
from collections import deque
mapin = lambda : map(int, sys.stdin.readline().split())
listin = lambda : list(map(int, sys.stdin.readline().split()))
inp = lambda : sys.stdin.readline()
(N, M, X, Y) = mapin()
veca = listin()
vecb = listin()
max_x = -10000
min_y = 10000
for i in veca:
	if max_x < i:
		max_x = i
for i in vecb:
	if min_y > i:
		min_y = i
if max_x < min_y and max_x > X and (min_y < Y):
	print('No War')
else:
	print('War')


(n, m, x, y) = list(map(int, input().split()))
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))
maxx = max(xn)
miny = min(yn)
if x < miny and miny <= y and (miny > maxx):
	print('No War')
else:
	print('War')


((N, M, X, Y), x, y) = eval('map(int,input().split()),' * 3)
print('No War'[3 * (max(X, *x) >= min(Y, *y)):])


i = lambda : list(map(int, input().split()))
(n, m, x, y) = i()
print('No ' * (max(i() + [x]) < min(i() + [y])) + 'War')


(n, m, x, y) = map(int, input().split())
zmin = max(map(int, input().split()))
zmax = min(map(int, input().split()))
if max(zmin, x) < min(zmax, y):
	print('No War')
else:
	print('War')


(n, m, x, y) = list(map(int, input().split()))
x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]
ans = 'War'
for i in range(x + 1, y + 1):
	if max(x_list) < i <= min(y_list):
		ans = 'No War'
		break
print(ans)


(N, M, X, Y) = map(int, input().split())
xi = list(map(int, input().split()))
yi = list(map(int, input().split()))
xi += [X]
yi += [Y]
if max(xi) < min(yi):
	print('No War')
else:
	print('War')


(N, M, X, Y) = (int(T) for T in input().split())
ACityMax = sorted((int(T) for T in input().split()))[-1]
BCityMin = sorted((int(T) for T in input().split()))[0]
if ACityMax < BCityMin and ACityMax < Y and (X < BCityMin):
	print('No War')
else:
	print('War')


(n, m, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
print(['War', 'No War'][X < min(y) and max(x) < Y and (max(x) < min(y))])


(N, M, X, Y) = map(int, input().split())
X_list = list(map(int, input().split()))
Y_list = list(map(int, input().split()))
maxX = max(X_list)
minY = min(Y_list)
for z in range(maxX + 1, minY + 1):
	if z > X and Y >= z:
		print('No War')
		return
print('War')


q = lambda : list(map(int, input().split()))
(n, m, x, y) = q()
a = q()
b = q()
print(['', 'No '][max(a) < min(b) and x < min(b) and (max(a) < y)] + 'War')


(_, _, x, y) = map(int, input().split())
X = list(map(int, input().split())) + [x]
Y = list(map(int, input().split())) + [y]
print('No War' if min(Y) - max(X) > 0 else 'War')


(n, m, x, y) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.append(x)
b.append(y)
a = sorted(a)
b = sorted(b)
if a[-1] < b[0]:
	print('No War')
else:
	print('War')


def __starting_point():
	(n, m, X, Y) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	x_max = max(x)
	y_min = min(y)
	flg = False
	for Z in range(X + 1, Y + 1):
		if x_max < Z <= y_min:
			flg = True
			break
	if flg:
		print('No War')
	else:
		print('War')
__starting_point()


(n, m, x, y) = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
if max(x_list) < min(y_list) and max(x_list) < y and (x < min(y_list)):
	print('No War')
else:
	print('War')


(n, m, x, y, *a) = map(int, open(0).read().split())
(X, Y) = (max(a[:n]), min(a[n:]))
print('No War' if X < y and x < Y and (X < Y) else 'War')


(n, m, x, y) = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))
xlist.append(x)
ylist.append(y)
if max(xlist) < min(ylist):
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
xs.append(x)
ys.append(y)
print('No War' if max(xs) < min(ys) else 'War')


(N, M, X, Y) = [int(s) for s in input().split()]
x = [int(s) for s in input().split()]
y = [int(s) for s in input().split()]
print('War' if max([X] + x) >= min([Y] + y) else 'No War')


(n, m, x, y) = map(int, input().split())
lx = list(map(int, input().split()))
ly = list(map(int, input().split()))
print('No War' if max(x, max(lx)) < min(y, min(ly)) else 'War')


(N, M, X, Y) = map(int, input().split())
Z = max(map(int, input().split())) + 1
min_y = min(map(int, input().split()))
print('No War' if X < Z and Z <= min_y and (Z <= Y) else 'War')


(N, M, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for Z in range(X + 1, Y + 1):
	if max(x) < Z <= min(y):
		print('No War')
		return
print('War')


i = lambda : map(int, input().split())
(_, _, x, y) = i()
print('No War' if len(set(range(max(i()) + 1, min(i()) + 1)).intersection(set(range(x + 1, y + 1)))) > 0 else 'War')


s = input().split()
n = int(s[0])
m = int(s[1])
x = int(s[2])
y = int(s[3])
city_a = []
city_b = []
v = input().split()
w = input().split()
for i in range(n):
	city_a.append(int(v[i]))
for i in range(m):
	city_b.append(int(w[i]))
city_a.sort()
city_b.sort()
p = city_a.pop()
q = city_b[0]
check = False
for i in range(x + 1, y + 1):
	if p < i <= q:
		check = True
		break
if check:
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
z = 'War'
for i in range(x + 1, y + 1):
	if max(xl) < i and i <= min(yl):
		z = 'No War'
		break
print(z)


from typing import List

def answer(n: int, m: int, x: int, y: int, xs: List[int], ys: List[int]) -> str:
	xs.append(x)
	ys.append(y)
	if min(ys) <= max(xs):
		return 'War'
	return 'No War'

def main():
	(n, m, x, y) = list(map(int, input().split()))
	xs = list(map(int, input().split()))
	ys = list(map(int, input().split()))
	print(answer(n, m, x, y, xs, ys))

def __starting_point():
	main()
__starting_point()


(n, m, x, y) = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
flag = False
if max(x_list) < min(y_list):
	flag = True
if flag:
	for i in range(max(x_list) + 1, min(y_list) + 1):
		if x < i <= y:
			flag = True
			break
		else:
			flag = False
if flag:
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
if max([int(a) for a in input().split()] + [x]) < min([int(b) for b in input().split()] + [y]):
	print('No', end=' ')
print('War')


(n, m, x, y) = map(int, input().split())
lx = list(map(int, input().split()))
ly = list(map(int, input().split()))
lx.append(x)
ly.append(y)
lx.sort()
ly.sort()
if lx[-1] < ly[0]:
	print('No War')
else:
	print('War')


(N, M, X, Y) = list([int(a) for a in input().split(' ')])
x = list([int(b) for b in input().split(' ')])
y = list([int(c) for c in input().split(' ')])
x.append(X)
y.append(Y)
x.sort()
y.sort()
if x[-1] < y[0]:
	print('No War')
else:
	print('War')


(N, M, X, Y) = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(['War', 'No War'][max([X] + xs) < min([Y] + ys)])


(n, m, x, y) = map(int, input().split())
x_ = [int(i) for i in input().split()]
y_ = [int(i) for i in input().split()]
print('No War' if max(max(x_), x) < min(min(y_), y) else 'War')


(n, m, x, y) = map(int, input().split())
for i in [i for i in range(max(list(map(int, input().split()))) + 1, min(list(map(int, input().split()))) + 1)]:
	if x < i <= y:
		print('No War')
		break
else:
	print('War')


(a, x, y) = [list(map(int, input().split())) for i in range(3)]
if max(a[2], sorted(x)[-1]) < min(a[3], sorted(y)[0]):
	print('No War')
else:
	print('War')


print('No War' if (lambda a: max(a[0][2], max(a[1])) < min(a[0][3], min(a[2])))([[int(j) for j in input().split()] for i in range(3)]) else 'War')


(N, M, X, Y) = map(int, input().split())
Xs = list(map(int, input().split()))
Ys = list(map(int, input().split()))
if max([X, max(Xs)]) < min([Y, min(Ys)]):
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
xp = list(map(int, input().split()))
yp = list(map(int, input().split()))
xp.append(x)
yp.append(y)
if max(xp) < min(yp):
	print('No War')
else:
	print('War')


i = lambda : map(int, input().split())
(_, _, x, y) = i()
print('No War' if max(sum([list(i()), [x]], [])) < min(sum([list(i()), [y]], [])) else 'War')


(N, M, x, y) = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
l = max(X)
r = min(Y)
print('No War' if l < r and (not (y <= l or r <= x)) else 'War')


(n, m, x, y) = map(int, input().split())
x = max([x] + [int(i) for i in input().split()])
y = min([y] + [int(i) for i in input().split()])
print('No ' * (x < y) + 'War')


def main():
	(N, M, X, Y) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	x.sort()
	y.sort()
	if X < x[len(x) - 1] < y[0] < Y:
		print('No War')
	else:
		print('War')
main()


import numpy as np
(n, m, x, y) = list(map(int, input().split()))
px = np.array([int(i) for i in input().split()])
py = np.array([int(i) for i in input().split()])
res = 'War'
for i in range(x + 1, y + 1):
	if np.count_nonzero(px < i) == n and np.count_nonzero(py >= i) == m:
		res = 'No War'
		break
print(res)


(n, m, X, Y) = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = sorted(x, reverse=False)[-1]
y = sorted(y, reverse=False)[0]
flg = 'War'
if x < x + 1 <= y:
	if x + 1 > X:
		if x + 1 <= Y:
			flg = 'No War'
print(flg)


(N, M, X, Y) = map(int, input().split())
A = list(map(int, input().split())) + [X]
B = list(map(int, input().split())) + [Y]
print('No War' if max(A) < min(B) else 'War')


(n, m, x, y) = (int(i) for i in input().split())
list_x = sorted(list(map(int, input().split())))
list_y = sorted(list(map(int, input().split())))
if max(x, list_x[-1]) < min(y, list_y[0]):
	print('No War')
else:
	print('War')


(_, _, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
k = max(x)
l = min(y)
print('No War' if X < l and k < Y and (k < l) else 'War')


(n, m, x, y) = list(map(int, input().split()))
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
print('No War' if max(xx) < min(yy) and x < min(yy) and (max(xx) < y) else 'War')


(n, m, x, y) = map(int, input().split())
l_x = list(map(int, input().split()))
l_y = list(map(int, input().split()))
l_x.append(x)
l_y.append(y)
print('No War' if min(l_y) - max(l_x) >= 1 else 'War')


(N, M, X, Y) = map(int, input().split())
x1 = map(int, input().split())
x2 = map(int, input().split())
if max(X, max(x1)) < min(Y, min(x2)):
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
lix = list(map(int, input().split()))
liy = list(map(int, input().split()))
if min(y, min(liy)) <= max(x, max(lix)):
	print('War')
else:
	print('No War')


(n, m, x, y) = map(int, input().split())
(a, b) = [list(map(int, input().split())) for i in range(2)]
for i in range(x + 1, y + 1):
	if all((j < i for j in a)) and all((k >= i for k in b)):
		print('No War')
		break
else:
	print('War')


(_, _, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x_max = max(x)
y_min = min(y)
flag = False
for z in range(X + 1, Y + 1):
	if x_max < z <= y_min:
		flag = True
print('No War' if flag else 'War')


(n, m, x, y) = list(map(int, input().split()))
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
xmax = max(xl)
ymin = min(yl)
isWar = True
for i in range(x + 1, y + 1):
	if xmax < i and ymin >= i:
		isWar = False
		break
if isWar:
	print('War')
else:
	print('No War')


s = list(map(int, input().split()))
t = list(map(int, input().split()))
u = list(map(int, input().split()))
if s[2] < max(t) < min(u) <= s[3]:
	print('No War')
else:
	print('War')


((*z, X, Y), x, y) = eval('map(int,input().split()),' * 3)
print('No War'[3 * (max(X, *x) >= min(Y, *y)):])


def mapt(fn, *args):
	return tuple(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	(n, m, x, y) = Input()
	x_data = Input()
	y_data = Input()
	x_max = max(x_data)
	y_min = min(y_data)
	ans = False
	for i in range(-100, 101):
		if x_max < i <= y_min and x < i <= y:
			ans = True
			break
	if ans:
		print('No War')
	else:
		print('War')
main()


(N, M, X, Y, *H) = map(int, open(0).read().split())
print('NWoa rW a r'[max(max(H[:N]), X) >= min(min(H[N:]), Y)::2])


(_, _, X, Y) = map(int, input().split())
xmax = max(map(int, input().split()))
ymin = min(map(int, input().split()))
if min(ymin, Y) - max(xmax, X) > 0:
	print('No War')
else:
	print('War')


import sys
(n, m, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for i in range(X + 1, Y + 1):
	if max(x) < i and min(y) >= i:
		print('No War')
		return
print('War')


(n, m, x, y) = list(map(int, input().split()))
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
for i in range(x + 1, y + 1):
	if max(xx) < i <= min(yy):
		print('No War')
		return
print('War')


(n, m, X, Y) = map(int, input().split())
a = max(map(int, input().split()))
b = min(map(int, input().split()))
if max(X, a) < min(Y, b):
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
print('War' if x >= min(b) or max(a) >= y or max(a) >= min(b) else 'No War')


(N, M, X, Y) = map(int, input().split())
lsx = list(map(int, input().split())) + [X]
lsy = list(map(int, input().split())) + [Y]
if max(lsx) < min(lsy):
	print('No War')
else:
	print('War')


(_, _, x, y) = map(int, input().split())
X = sorted(map(int, input().split()))
Y = sorted(map(int, input().split()))
if max(x, max(X)) < min(y, min(Y)):
	print('No War')
else:
	print('War')


(N, M, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for z in range(-100, 101):
	if max(max(x), X) < z and z <= min(min(y), Y):
		print('No War')
		break
else:
	print('War')


(n, m, x, y) = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
mx = max(X)
my = min(Y)
if mx < my:
	for i in range(mx + 1, my + 1):
		if x < i <= y:
			print('No War')
			return
	print('War')
else:
	print('War')


(n, m, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort(reverse=True)
y.sort()
flag = 0
for i in range(X + 1, Y + 1):
	if x[0] < i and y[0] >= i:
		flag = 1
		break
	else:
		flag = 0
if flag == 1:
	print('No War')
else:
	print('War')


N = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
if max(X) < min(Y) and N[2] < max(X) and (N[3] > min(Y)):
	print('No War')
else:
	print('War')


(N, M, X, Y) = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
Z = [X + 1, Y]
x.sort()
y.sort()
Z[0] = max(x[-1] + 1, Z[0])
Z[1] = min(y[0], Z[1])
print('No War' if Z[0] <= Z[1] else 'War')


(N, M, X, Y) = list(map(int, input().split()))
max_X = max(list(map(int, input().split())))
min_Y = min(list(map(int, input().split())))
for Z in range(X + 1, Y + 1):
	if max_X < Z <= min_Y:
		print('No War')
		return
else:
	print('War')


(n, m, X, Y) = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
print(('No ' if max(X, *x) < min(Y, *y) else '') + 'War')


(n, m, x, y) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort(reverse=True)
b.sort()
bool = False
if a[0] < b[0]:
	for i in range(a[0] + 1, b[0] + 1):
		if x < i and i <= y:
			bool = True
if bool:
	print('No War')
else:
	print('War')


(n, m, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for z in range(X + 1, Y):
	if max(x) < z <= min(y):
		print('No War')
		return
print('War')


(n, m, x, y) = map(int, input().split())
xl = sorted([int(i) for i in input().split()])
yl = sorted([int(i) for i in input().split()])
print('No War' if max(x, xl[-1]) < min(y, yl[0]) else 'War')


(n, m, x, y) = map(int, input().split())
a = [int(i) for i in input().split()] + [x]
b = [int(i) for i in input().split()] + [y]
A = max(a)
B = min(b)
print('No War' if A < B else 'War')


(n, m, x, y) = map(int, input().split())
xn = map(int, input().split())
ym = map(int, input().split())
if max(x, max(xn)) < min(y, min(ym)):
	print('No War')
else:
	print('War')


(N, M, X, Y) = map(int, input().split())
A = [X] + [int(x) for x in input().split()]
B = [Y] + [int(x) for x in input().split()]
print('No War' if max(A) < min(B) else 'War')


def __starting_point():
	(n, m, x, y) = list(map(int, input().split()))
	X = list(map(int, input().split()))
	Y = list(map(int, input().split()))
	X.sort()
	Y.sort()
	flg = False
	if Y[0] <= x:
		flg = True
	elif y <= X[n - 1]:
		flg = True
	elif X[n - 1] >= Y[0]:
		flg = True
	if flg:
		print('War')
	else:
		print('No War')
__starting_point()


(n, m, x, y) = map(int, input().split())
xc = list(map(int, input().split()))
yc = list(map(int, input().split()))
if max(x, max(xc)) < min(y, min(yc)):
	print('No War')
else:
	print('War')


(N, M, X, Y) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.append(X)
B.append(Y)
A.sort()
B.sort()
if A[-1] >= B[0]:
	print('War')
else:
	print('No War')


i = input
x = i().split()
print('No ' * (max(map(int, i().split() + x[2:3])) < min(map(int, i().split() + x[3:4]))) + 'War')


(N, M, X, Y, *xy) = map(int, open(0).read().split())
for Z in range(max(X, max(xy[:N])) + 1, min(Y, min(xy[N:])) + 1):
	print('No War')
	exit()
print('War')


(N, M, X, Y) = map(int, input().split())
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
xx.sort()
yy.sort()
for Z in range(X + 1, Y):
	if Z > xx[-1] and yy[0] >= Z:
		print('No War')
		return
print('War')


I = lambda : map(int, input().split())
(N, M, X, Y) = I()
print('No War' if max(list(I()) + [X]) < min(list(I()) + [Y]) else 'War')


(N, M, X, Y) = map(int, input().split())
x_lis = list(map(int, input().split()))
y_lis = list(map(int, input().split()))
x_max = max(x_lis)
y_min = min(y_lis)
ans = 'War'
for Z in range(X + 1, Y + 1):
	if x_max < Z <= y_min:
		ans = 'No War'
print(ans)


(x, y) = input().split()[2:]
print('No ' * (max(map(int, input().split() + [x])) < min(map(int, input().split() + [y]))) + 'War')


(_, _, X, Y) = map(int, input().split())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
x.append(X)
y.append(Y)
print('No War' if max(x) < min(y) else 'War')


def inpl():
	return list(map(int, input().split()))
(n, m, x, y) = inpl()
xs = inpl()
ys = inpl()
if max(xs) >= min(ys) or y <= max(xs) or min(ys) <= x:
	print('War')
else:
	print('No War')


def i():
	return list(map(int, input().split()))
(*_, x, y) = i()
print('No ' * (max(i() + [x]) < min(i() + [y])) + 'War')


import sys
(n, m, x, y) = list(map(int, input().split()))
x1 = max(list(map(int, input().split())))
y1 = min(list(map(int, input().split())))
for i in range(x + 1, y + 1):
	if x1 < i <= y1:
		print('No War')
		return
print('War')


(a, b, c, d) = map(int, input().split())
a = list(map(int, input().split())) + [c]
b = list(map(int, input().split())) + [d]
print('No War' if max(a) < min(b) else 'War')


print('No War' if (lambda a: max(a[2], max(list(map(int, input().split())))) < min(a[3], min(list(map(int, input().split())))))(list(map(int, input().split()))) else 'War')


a = list(map(int, input().split()))
b = max(map(int, input().split()))
c = min(map(int, input().split()))
print('No War' if b + 1 < a[3] and a[2] + 1 < c and (b < c) else 'War')


(n, m, x, y) = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
if max(max(p), x) < min(min(q), y):
	print('No War')
else:
	print('War')


(a, b, x, y) = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
xx = max(xl)
xx = max(xx, x)
yy = min(yl)
yy = min(yy, y)
if xx < yy:
	print('No War')
else:
	print('War')


(n, m, x, y) = map(int, input().split())
(a, b) = (list(map(int, input().split())), list(map(int, input().split())))
a.sort()
b.sort()
print('No War' if max(a[-1], x) < min(y, b[0]) else 'War')


import sys
stdin = sys.stdin

def ns():
	return stdin.readline().rstrip()

def ni():
	return int(stdin.readline().rstrip())

def nm():
	return list(map(int, stdin.readline().split()))

def nl():
	return list(map(int, stdin.readline().split()))

def main():
	(n, m, x, y) = nm()
	X = nl()
	Y = nl()
	xx = max(X)
	yy = min(Y)
	for z in range(-100, 101):
		if x < z <= y and xx < z <= yy:
			print('No War')
			return
	print('War')

def __starting_point():
	main()
__starting_point()


(n, m, x1, y1) = map(int, input().split())
x = list(map(int, input().split())) + [x1]
y = list(map(int, input().split())) + [y1]
if max(x) < min(y):
	print('No War')
else:
	print('War')


(N, M, X, Y) = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())
xmax = max(x)
ymin = min(y)
print('No War' if xmax < ymin and xmax < Y and (X < ymin) else 'War')


f = lambda : map(int, input().split())
(n, m, x, y) = f()
lx = [x] + list(f())
ly = [y] + list(f())
print(['War', 'No War'][max(lx) < min(ly)])


(n, m, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
cnt = 0
for z in range(-100, 101):
	if X < z and z <= Y and (max(x) < z) and (min(y) >= z):
		print('No War')
		break
	else:
		cnt += 1
		if cnt == 201:
			print('War')
			break


(n, m, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
Z_start = x[-1] + 1
Z_end = y[0]
for z in range(Z_start, Z_end + 1):
	if X < z <= Y:
		print('No War')
		return
print('War')


(n, m, x, y) = map(int, input().split())
a = max([int(i) for i in input().split()])
b = min([int(i) for i in input().split()])
if a < b and x < a + 1 <= y:
	print('No War')
else:
	print('War')


(n, m, x, y) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
max_x = max(a)
min_y = min(b)
max_x = max(max_x, x)
min_y = min(min_y, y)
if max_x < min_y:
	print('No War')
else:
	print('War')


(n, m, a, b) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
if x[-1] < y[0]:
	for i in range(x[-1] + 1, y[0] + 1):
		if a < i < b:
			print('No War')
			break
	else:
		print('War')
else:
	print('War')


I = lambda : [int(i) for i in input().split()]
(n, m, x, y) = I()
a = sorted(I())
b = sorted(I())
t = b[-m]
if x < t <= y and sum((1 for i in a if i < t)) >= n:
	print('No War')
else:
	print('War')


def readinput():
	(n, m, x, y) = list(map(int, input().split()))
	xx = list(map(int, input().split()))
	yy = list(map(int, input().split()))
	return (n, m, x, y, xx, yy)

def main(n, m, x, y, xx, yy):
	xx.append(x)
	yy.append(y)
	xx.sort()
	yy.sort()
	if xx[-1] < yy[0]:
		return 'No War'
	else:
		return 'War'

def __starting_point():
	(n, m, x, y, xx, yy) = readinput()
	ans = main(n, m, x, y, xx, yy)
	print(ans)
__starting_point()


(n, m, x, y) = map(int, input().split())
xx = sorted(map(int, input().split()))
yy = sorted(map(int, input().split()))
print(['', 'No '][x < yy[0] and xx[-1] < yy[0] and (xx[-1] < y)] + 'War')


(N, M, X, Y) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
sx = sorted(x)
sy = sorted(y)
if sx[-1] < sy[0] and X < sy[0] and (sx[-1] < Y):
	print('No War')
else:
	print('War')


(a, b, x, y) = map(int, input().split())
print(['War', 'No War'][sorted([x] + [int(i) for i in input().split()])[-1] < sorted([y] + [int(i) for i in input().split()])[0]])


(n, m, x, y) = map(int, input().split())
a = max(list(map(int, input().split())))
b = min(map(int, input().split()))
print(['War', 'No War'][any((a < i <= b for i in range(x + 1, y + 1)))])


(N, M, X, Y) = [int(i) for i in input().split()]
x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]
x_max = max(x_list)
y_min = min(y_list)
ans = 'War'
for Z in range(X + 1, Y + 1):
	if x_max < Z <= y_min:
		ans = 'No War'
		break
print(ans)


(N, M, X, Y) = map(int, input().split())
lx = [int(x) for x in input().split()]
lx.append(X)
ly = [int(y) for y in input().split()]
ly.append(Y)
if X >= Y or max(lx) >= min(ly):
	print('War')
else:
	print('No War')


url = 'https://atcoder.jp//contests/abc110/tasks/abc110_b'

def main():
	(n, m, x, y) = list(map(int, input().split()))
	xs = list(map(int, input().split()))
	ys = list(map(int, input().split()))
	xs.sort()
	ys.sort()
	if xs[-1] >= ys[0]:
		print('War')
		return
	for i in range(xs[-1] + 1, ys[0] + 1):
		if x < i <= y:
			print('No War')
			return
	print('War')

def __starting_point():
	main()
__starting_point()