Problem:
 Score : 200 points    Problem Statement 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 1 3 2 10 20
8 15 13
16 22      Sample Output 1 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        Sample Input 2 4 2 -48 -1
-20 -35 -91 -23
-22 66      Sample Output 2 War       Sample Input 3 5 3 6 8
-10 3 1 5 -100
100 6 14      Sample Output 3 War

Solution (Python):
n, m, x, y = map(int, input().split())
x_city = list(map(int, input().split()))
y_city = list(map(int, input().split()))
x_city.sort()
y_city.sort()
if y_city[0] - x_city[-1] > 0 and x < y_city[0] and x_city[-1] < y:
    print('No War')
else:
    print('War')

Solution (Python):
import sys
N, M, X, Y = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
x.sort()
y.sort()
if X < Y:
    num = 0
    for Z in range(X+1, Y+1):
        num += 1
        if x[-1] < Z and y[0] >= Z:
            print('No War')
            sys.exit()
    if num == Y-X:
        print('War')
else:
    print('War')

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

Solution (Python):
N,M,X,Y = map(int,input().split())

x=list(map(int, input().split())) 
y=list(map(int, input().split())) 

maxX=max(x)
minY=min(y)

if maxX<minY:
    if X<minY and minY<=Y:
        print("No War")
    else:
        print('War')
else:
    print('War')

Solution (Python):
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")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = sorted(list(map(int, input().split())))
y = sorted(list(map(int, input().split())))
Z = y[0]

if Z>=Y:
    Z = Y

if X<Z<=Y and x[N-1]<Z and y[M-1]>=Z:
    print('No War')
else:
    print('War')

Solution (Python):
n, m, x ,y = map(int, input().split())
l_x = list(map(int, input().split()))
l_y = list(map(int, input().split()))

if max(l_x)>=min(l_y) or max(l_x)>=y or min(l_y)<=x:
    print("War")
else:
    print("No War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
f3 = False
for z in range(X+1, Y+1):
    f1 = True
    for i in range(N):
        if x[i] >= z:
            f1=False

    for i in range(M):
        if y[i] < z:
            f1=False

    if f1==True:
        print('No War')
        exit()

print('War')

Solution (Python):
a = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
z = "War"

for i in range(a[2]+1,a[3]+1):
  if max(x)<i<=min(y):
    z = "No War"
else:
  print(z)

Solution (Python):
N, M, X, Y = map(int,input().split())
lineX = list(map(int,input().split()))
lineY = list(map(int,input().split()))

lineX.append(X)
lineY.append(Y)

if max(lineX) < min(lineY):
    print("No War")
else:
    print("War")

Solution (Python):
import sys

n, m , x, y= map(int, input().split())

X = list(map(int, input().split()))

Y = list(map(int, input().split()))

xm = max(X)

ym = min(Y)


for z in range(x+1, y+1):
    if(z > xm and z <= ym):
        print("No War")
        sys.exit()


print("War")

Solution (Python):



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 my - mx > 0 and x < my <= y and x < mx <= y:
    print('No War')
else:
    print('War')

Solution (Python):
_, _, X, Y = list(map(int, input().split()))
x = sorted(list(map(int, input().split())) + [X])
y = sorted(list(map(int, input().split())) + [Y])
if x[-1] < y[0]:
  print("No War")
else:
  print("War")

Solution (Python):
l = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
bool = False
for i in range(-100,101):
    if max(x) < i and min(y) >= i and l[2] < i and l[3] >= i:
        bool = True
        break
if bool == True:
    print('No War')
else:
    print('War')

Solution (Python):
n, m, X, Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

if X < Y and max(max(x), X) < min(y) and max(x) < min(min(y), Y):
  print("No War")
else:
  print("War")

Solution (Python):
a, b, c, d = map(int, input().split())
e = list(map(int, input().split()))
f = list(map(int, input().split()))
e.sort()
f.sort()
for i in range(e[len(e)-1] + 1, f[0] + 1):
    if c < i <= d:
        print("No War")
        exit()
print("War")

Solution (Python):

n, m, x, y = map(int,input().split())




xls = list(map(int,input().split()))
yls = list(map(int,input().split()))

for i in range(x+1,y):
  if max(xls) < i <= min(yls):
    print("No War")
    quit()
print("War")

Solution (Python):
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, Y+1):
  if X < i <= Y and max(x) < i <= min(y):
    print("No War")
    exit()
print("War")

Solution (Python):
import numpy as np
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

Z = np.linspace(X + 1, Y - 1, Y - X - 1)

for i in Z:
    if max(sorted(x)) < i and i <= min(sorted(y)):
        print("No War")
        exit()
print("War")

"""
3 2 10 20
8 15 13
16 22
"""

Solution (Python):
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')

Solution (Python):
n, m, x, y = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
xl.append(x)
yl.append(y)
xl.sort()
yl.sort()
if yl[0] > xl[-1]:
    print('No War')
else:
    print('War')

Solution (Python):
def resolve():
	n,m,x,y=map(int,input().split())
	xlist=list(map(int,input().split()))
	ylist=list(map(int,input().split()))
	
	mx=max(xlist)
	my=min(ylist)
	
	if mx<my:
		for z in range(mx+1,my+1):
			if x<z<=y:
				print('No War')
				break
		else:
			print('War')
	else:
		print('War')
resolve()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())


N,M,X,Y=LI()
xs=LI()
ys=LI()
Zmin = max(X, *xs)+1
Zmax = min(Y, *ys)

if Zmin <= Zmax:
    print('No War')
else:
    print('War')

Solution (Python):
n,m,x,y = map(int,input().split())
lstx = list(map(int,input().split()))
lsty = list(map(int,input().split()))
max_x = max(lstx)
min_y = min(lsty)
for z in range(x+1,y+1):
    if (max_x<z) and (min_y>=z):
        print('No War')
        exit()
print('War')

Solution (Python):
n,m,x,y = map(int, input().split())
x_city = sorted(list(map(int, input().split())))
y_city = sorted(list(map(int, input().split())))

if x_city[len(x_city)-1] < y_city[0] and (x < y_city[0] <= y):
    print("No War")
else:
    print("War")

Solution (Python):
n,m,X,Y=map(int, input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.append(X)
y.append(Y)
if max(x)<min(y):
    print("No War")
else:
    print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())
lst_x = list(map(int, input().split()))
lst_y = list(map(int, input().split()))

if min(lst_y)<=max(lst_x):
    print('War')
else:
    if Y<=max(lst_x) or min(lst_y)<=X:
        print('War')
    else:
        print('No War')

Solution (Python):
N, M, X, Y = map(int, input().split())
lst_x = list(map(int, input().split()))
lst_y = list(map(int, input().split()))

if min(lst_y)<=max(lst_x):
    print('War')
else:
    if Y<=max(lst_x) or min(lst_y)<X+1:
        print('War')
    else:
        print('No War')

Solution (Python):
n,m,x,y = map(int,input().split())
l_x = list(map(int,input().split()))
l_y = list(map(int,input().split()))
xy = set(range(x+1,y+1))
z = set(range(max(l_x)+1,min(l_y)+1))
if len(xy&z) == 0 :print("War")
else:print("No War")

Solution (Python):
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x = max(x)
y = min(y)
if x >= y:
  print('War')
else:
  print('No War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = max([int(x) for x in input().split()])
y = min([int(y) for y in input().split()])

if (X >= Y):
    print('War')
    exit()

for z in range(X+1, Y+1, 1):
    if x < z and z <= y:
        print('No War')
        break
else:
    print('War')

Solution (Python):
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 max(X, x[-1])<min(Y, y[0]):
  print("No War")
else:
  print("War")

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, M, X, Y = nl()
Xs = nl()
Ys = nl()
Xs.append(X)
Ys.append(Y)

maxX = max(Xs)
minY = min(Ys)
if maxX < minY:
    print('No War')
else:
    print('War')

Solution (Python):
N,M,X,Y = map(int,input().split())
lis_x = list(map(int,input().split()))
lis_y = list(map(int,input().split()))
m_x = max(lis_x)
m_y = min(lis_y)
if m_x < m_y and X < m_y and m_x < Y:
    print("No War")
else:
    print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())

x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.sort()
y.sort()

def is_war(x, y, N, M):
    if x[N-1] >= y[0]:
        return False
    elif x[N-1] >= Y:
        return False
    elif y[0] <= X:
        return False
    else:
        return True

if is_war(x, y, N, M):
    print("No War")
else:
    print("War")

Solution (Python):
_, _, 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")

Solution (Python):
n,m,x,y=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
pm=max(p)
qm=min(q)
a='War'
if x<y and pm<qm:
  for i in range(x+1,y+1):
    if pm<i and i<=qm:
      a='No War'
      break
print(a)

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
A = []
B = []
a = 0
for k in range(X + 1, Y, 1):
    A.append(k)
for i in range(len(A)):
    if max(x) < int(A[i]):
        B.append(A[i])
for j in range(len(B)):
    if min(y) >= int(B[j]):
        a += 1
    else:
        a += 0
if a == 0:
    print("War")
else:
    print("No War")

Solution (Python):
n, m, x, y = map(int, 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)

for z in range(x + 1, y + 1):
    if x_max < z and z <= y_min:
        print('No War')
        exit()
print('War')

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

Solution (Python):
N, M, X, Y = map(int, input().split())
x = sorted(list(map(int, input().split())), reverse = True)
y = sorted(list(map(int, input().split())))

if X < x[0] < y[0] <= Y and (not X in y) and (not Y in x):
  print("No War")
else:
  print("War")

Solution (Python):
n,m,x,y = map(int,input().split())
xlis = list(map(int,input().split()))
ylis = list(map(int,input().split()))
xlis.sort()
ylis.sort()
if xlis[-1] < ylis[0] and x < ylis[0] < y:
    print('No War')
else:
    print('War')

Solution (Python):
N,M,X,Y = map(int, input().split())
xar = list(map(int, input().split()))
yar = list(map(int, input().split()))

if max(xar) >= min(yar):
    print('War')
    exit()


for i in range(max(xar)+1,min(yar)+1):
    if i > X and i <= Y:
        print('No War')
        exit()
else:
    print('War')

Solution (Python):
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')

Solution (Python):
def abc():
    n, m, x, y = map(int, input().rstrip().split())
    xx = [x]
    xx.extend(map(int, input().rstrip().split()))
    xx.sort()
    yy = [y]
    yy.extend(map(int, input().rstrip().split()))
    yy.sort()
    print('No War' if xx[-1] < yy[0] else 'War')


abc()

Solution (Python):
n, m, x, y = map(int, input().split())
xlst = [int(i) for i in input().split()]
ylst = [int(i) for i in input().split()]

xcon = max(xlst)
ycon = min(ylst)

anslst = [int(i) for i in range(x+1, y+1)]

for i in anslst:
    if i > x and i <= y:
        if i > xcon and i <= ycon:
            print('No War')
            exit()
else:
    print('War')
    exit()

Solution (Python):
N,M,X,Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]

x = max(X,max(x))
y = min(Y,min(y))

answer = 'War' if y <= x else 'No War'

print(answer)

Solution (Python):
N, M, x, y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))

X.append(x)
Y.append(y)

X.sort(reverse=True)
Y.sort()

if Y[0] > X[0]:
    print('No War')
else:
    print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())

xs = list(map(int, input().split()))
xs.append(X)
ys = list(map(int, input().split()))
ys.append(Y)

if max(xs) < min(ys):
    print("No War")
else:
    print("War")

Solution (Python):
n,m,x,y=map(int,input().split())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))
xl.append(x)
yl.append(y)
if max(xl)<min(yl):
  print("No War")
else:
  print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

a = max(X, max(x)) + 1
b = min(Y,min(y)) 

if a <= b:
    print('No War')
else:
    print('War')

Solution (Python):
N, M, X, Y = input().split()

N = int(N)
M = int(M)
X = int(X)
Y = int(Y)

x = list(map(int,input().split()))
y = list(map(int,input().split()))

x_max = max(x)
y_min = min(y)

if( Y - X > 0 and y_min - x_max > 0 and Y - x_max > 0 and y_min - X > 0):
    print("No War")
    
else:
    print ("War")

Solution (Python):
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 max(X, x[N-1]) < min(Y, y[0]):
    print("No War")
else:
    print("War")

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


N, M, X, Y = list(map(int, sys.stdin.readline().split()))
Xs = list(map(int, sys.stdin.readline().split()))
Ys = list(map(int, sys.stdin.readline().split()))

Xs.append(X)
Ys.append(Y)
if max(Xs)< min(Ys):
    print('No War')
else:
    print('War')

Solution (Python):
import sys

N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)

if(max(x) < min(y)):
    print('No War')
else:
    print('War')

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

Solution (Python):
N, M, X, Y = map(int, input().split())
X_list = list(map(int, input().split()))
X_list.append(X)
Y_list = list(map(int, input().split()))
Y_list.append(Y)
if max(X_list) < min(Y_list):
    print('No War')
    exit(0)
print('War')

Solution (Python):
n,m,x,y = map(int,input().split())

lsx = list(map(int,input().split()))
lsx.append(x)
lsy = list(map(int,input().split()))
lsy.append(y)

if min(lsy) - max(lsx) > 0:
    print("No War")
else:
    print("War")

Solution (Python):
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(x)<min(y) and any(X<z<Y for z in range(max(x),min(y)+1)) else "War")

Solution (Python):
N, M, X, Y = map(int, input().split())
list_x = [int(i) for i in input().split()]
list_y = [int(j) for j in input().split()]
if max(list_x) >= min(list_y):
    print('War')
else:
    if X < max(list_x) + 1 <= Y:
        print('No War')
    else:
        print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

lower_bound = max(X, max(x))
upper_bound = min(Y, min(y))

if upper_bound - lower_bound > 0:
  print('No War')
else:
  print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
list_x = [int(i) for i in input().split()]
list_y = [int(j) for j in input().split()]
if max(list_x) >= min(list_y):
    print('War')
else:
    if X < max(list_x) + 1 <= Y:
        print('No War')
    else:
        print('War')

Solution (Python):
n,m,X,Y=map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))



   
    
if max(x)>=min(y):
    print('War')
else:
    if X<max(x)+1<=Y:
        print('No War')
    else:
        print('War')

Solution (Python):
n,m,x,y = map(int,input().split())
lix = list(map(int,input().split()))
liy = list(map(int,input().split()))
lix.append(x)
liy.append(y)

if max(lix) < min(liy):
  print("No War")
else:
  print("War")

Solution (Python):
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if max(x+[X]) < min(y+[Y]):
    print('No War')
else:
    print('War')

Solution (Python):
n, m, x, y = map(int, input().split())
xn = list(map(int,input().split()))
ym = list(map(int,input().split()))
max_xn = max(xn)
min_ym = min(ym)
a = range(max_xn, min_ym+1)
ac = False
for i in a:
  if max_xn < i <= min_ym and x < i < y:
    ac = True
    break
if ac:
  print("No War")
else:
  print("War")

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

Solution (Python):
a,b,x,y = map(int, input().split())


xlist=list(map(int, input().split()))
ylist=list(map(int, input().split()))

xlist.sort(reverse=True)
ylist.sort()

xmax = xlist[0]
ymin = ylist[0]

ans = "War"

for i in range(-100, 100):
    if x < i <= y:
        if xmax < i <= ymin:
            ans = "No War"

print(ans)

Solution (Python):



import sys

input = sys.stdin.readline

def main():
    _, _, x, y = map(int, input().split())
    X = list(map(int, input().split()))
    Y = list(map(int, input().split()))

    max_x = max(X)
    min_y = min(Y)
    for i in range(x, y + 1):
        if max_x < i and i <= min_y and x < i and i <= y:
            print("No War")
            return
    print("War")

main()

Solution (Python):
N,M,X,Y = map(int,input().split())


x = map(int, input().split())
y = map(int, input().split())
a = min(y)
b = max(x)
if X < Y:
    if b >= a:
        print("War")
    elif X >= a:
        print("War")
    elif Y <= b:
        print("War")
    else:
        print("No War")
else:
    print("War")

Solution (Python):
n, m, x, y = input().split()
xi = max(map(int, input().split()))
yi = min(map(int, input().split()))
print("No War") if (xi < yi) and (int(x) < yi) and((xi+1) <= int(y)) else print("War")

Solution (Python):
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
if (max(b) < min(c)) and (max(b) < a[3]) and (min(c) > a[2]):
    print("No War")
else:
    print("War")

Solution (Python):
N,M,X,Y=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
if max(A) >= min(B):
  print("War")
elif X >= min(B):
  print("War")
elif Y < min(B):
  print("War")
else:
  print("No War")

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

Solution (Python):
n,m,X,Y=map(int,input().split())
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
a=0
for i in range(X+1,Y+1):
    if max(x)<i<=min(y):
        print("No War")
        a+=1
        break
if  a==0:
    print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
if X < Y and max(max(x_list), X) < min(min(y_list), Y):
    print('No War')
else:
    print('War')

Solution (Python):
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

if max(x) < min(y) and X < min(y) and max(x) < Y:
    print("No War")
else:
    print("War")

Solution (Python):
n,m,X,Y=map(int,input().split())
x_List=list(map(int,input().split()))
y_List=list(map(int,input().split()))
x_List.append(X)
y_List.append(Y)
ans=''
if max(x_List)<min(y_List):
  ans='No War'
else:
  ans='War'
print(ans)

Solution (Python):
n,m,X,Y=map(int,input().split())
x_List=list(map(int,input().split()))
y_List=list(map(int,input().split()))
x_List.append(X)
y_List.append(Y)
ans=''
if max(x_List)<min(y_List):
  ans='No War'
else:
  ans='War'
print(ans)

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if X < max(x) and max(x) < min(y) and min(y) <= Y:
    print("No War")
else:
    print("War")

Solution (Python):
a,b,x,y=map(int,input().split())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))
xl.append(x)
xl.sort()
yl.append(y)
yl.sort()
xm=xl[a]
ym=yl[0]
if xm<ym:
    print('No War')
else:
    print('War')

Solution (Python):
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")

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

Solution (Python):
N,M,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

if min(Y,min(y)) - max(X,max(x)) > 0:
  print("No War")
else:
  print("War")

Solution (Python):
n,m,x,y = list(map(int,input().split()))
x_city = list(map(int,input().split()))
y_city = list(map(int,input().split()))
x_city.sort()
y_city.sort()
for i in range(x+1, y+1):
  if x_city[-1] < i and i <= y_city[0]:
    print('No War')
    quit()
  else:
    pass
print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

Z = max(x)+1
if X < Z <= Y and Z <= min(y):
    print('No War')
else:
    print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(max(x), X)
min_y = min(min(y), Y)

if max_x < min_y:
	print('No War')
else:
	print('War')

Solution (Python):
n, m, x, y = list(map(int, input().split()))
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))

xm = max(max(xn), x)
ym = min(min(yn), y)

print("No War" if xm < ym else "War")

Solution (Python):
_, _, x, y = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
X.append(x)
Y.append(y)
print("No War" if max(X) < min(Y) else "War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x_list = []
y_list = []
for v in x:
    x_list.append(v)
for v in y:
    y_list.append(v)
x_list.sort(reverse=True)
y_list.sort()
if x_list[0]>=y_list[0]:
    print('War')
else:
    XY = list(range(x_list[0]+1, y_list[0]+1))
    for v in XY:
        if (v > X) and (v <= Y):
            print('No War')
            break
        print('War')

Solution (Python):
n,m,X,Y=map(int,input().split())
x=max(list(map(int,input().split())))
y=min(list(map(int,input().split())))
if x<y and y>X and y<=Y:
  print("No War")
else:
  print("War")

Solution (Python):
n,m,x,y = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
X.append(x)
Y.append(y)
if max(X) < min(Y):
    print("No War")
else:
    print("War")

Solution (Python):

lst_1 = input().split()

N = int(lst_1[0])
M = int(lst_1[1])
X = (lst_1[2])
Y = (lst_1[3])

lst_X = input().split()
lst_Y = input().split()

lst_X.append(X)
lst_Y.append(Y)

for i in range(N+1):
    lst_X[i] = int(lst_X[i])
for i in range(M+1):
    lst_Y[i] = int(lst_Y[i])

X_max = max(lst_X)
Y_min = min(lst_Y)

if X_max < Y_min:
    ans = "No War"

else:
    ans = "War"

print(ans)

Solution (Python):

lst_1 = input().split()

N = int(lst_1[0])
M = int(lst_1[1])
X = (lst_1[2])
Y = (lst_1[3])

lst_X = input().split()
lst_Y = input().split()

lst_X.append(X)
lst_Y.append(Y)

for i in range(N+1):
    lst_X[i] = int(lst_X[i])
for i in range(M+1):
    lst_Y[i] = int(lst_Y[i])

X_max = max(lst_X)
Y_min = min(lst_Y)

if (X_max < Y_min) and (X < Y):
    ans = "No War"

else:
    ans = "War"

print(ans)

Solution (Python):
N, M, X, Y = map(int,input().split())

x = list(map(int,input().split()))
y = list(map(int,input().split()))

x.append(X)
y.append(Y)

if max(x) < min(y):
    print("No War")
else:
    print("War")

Solution (Python):
N, M, X, Y = [int(nmxy) for nmxy in input().split()]
x = [int(xx) for xx in input().split()]
y = [int(yy) for yy in input().split()]
x_Z = max(x)
Z_y = min(y)
for Z in range(X+1, Y):
  if x_Z < Z <= Z_y:
    print("No War")
    break
else:
  print("War")

Solution (Python):
n, m, x, y = map(int, input().split())
target_x = list(map(int, input().split()))
target_y = list(map(int, input().split()))

mx = max(target_x)
my = min(target_y)

if mx < my and x < my <= y:
  print('No War')
else:
  print('War')

Solution (Python):

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

Solution (Python):
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
a.append(x)
b=list(map(int,input().split()))
b.append(y)
print("No War" if max(a)<min(b) else "War")

Solution (Python):
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))

max_x = max(xn + [x])
min_y = min(yn + [y])

print("War" if max_x >= min_y else "No War")

Solution (Python):
import sys

n, m, X, Y = map(int, input().split())

x = list(map(int, (input().split())))
y = list(map(int, input().split()))
xlist = []
ylist = []

for j in range(X+1, Y):
    if max(x) < j:
        xlist.append(j)
    if min(y) >= j:
        ylist.append(j)

for k in range(len(xlist)):
    if xlist[k] in ylist:
        print("No War")
        sys.exit()
    
print("War")

Solution (Python):
n, m, x, y = [ int(v) for v in input().split() ]
xmax = max(sorted([ int(v) for v in input().split() ] + [x]))
ymin = min(sorted([ int(v) for v in input().split() ] + [y]))
ans = "War"
if xmax < ymin:
  ans = "No War"
print(ans)

Solution (Python):
n,m,x,y = map(int,input().split())
xlist = list(int(i) for i in input().split())
ylist = list(int(i) for i in input().split())
z = max(xlist)+1
if z <= min(ylist) and x < z and z <= y:
  print("No War")
else:
  print("War")

Solution (Python):
_,_,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')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]

if max(X, max(x)) < min(Y, min(y)):
    print("No War")
else:
    print("War")

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,m, xn,yn = f()
    x = f()
    y = f()

    xmax = max(x)
    ymin = min(y)

    for i in range(xmax+1, ymin+1):
        if xmax< ymin and xmax+1>xn and xmax+1<=yn:
            print('No War')
            return
    
    print('War')


solve()

Solution (Python):
N, M, X, Y = map(int, input().split())
x = sorted(list(map(int, input().split())),reverse=True)
y = sorted(list(map(int, input().split())))

if x[0] > X and y[0] <= Y and y[0] > x[0]:
  print("No War")
else:
  print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())
lstX = list(map(int, input().split()))
lstY = list(map(int, input().split()))
lstX.sort(reverse=True)
lstY.sort()


if lstX[0] > X and lstX[0] + 1 <= lstY[0] and lstX[0] + 1 <= Y:
    print('No War')
elif lstX[0] < X and X + 1 <= lstY[0] and X + 1 <= Y:
    print('No War')
else:
    print('War')

Solution (Python):
from sys import stdin

N, M, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
x = sorted([int(x) for x in stdin.readline().rstrip().split()], reverse=True)
y = sorted([int(x) for x in stdin.readline().rstrip().split()])
if y[0] > x[0] and Y > x[0] and X < y[0]:
    print('No War')
else:
    print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
y = list(map(int, input().split()))
y.append(Y)

if max(x) >= min(y):
    print('War')
else:
    print('No War')

Solution (Python):
_, _, x, y = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

if min(Y)-max(X) >= 1 and x < min(Y) and y > max(X):
  print('No War')
else:
  print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

xmax = max(x)
ymin = min(y)
for i in range(X+1, Y+1):
  if xmax < i <= ymin:
    print("No War")
    exit()
print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(X)
y.append(Y)

if max(x) < min(y):
    print('No War')
else:
    print('War')