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 = max(map(int, input().split()))
y = min(map(int, input().split()))
if x < y and x < Y and X < y:
    print("No War")
else:
    print("War")

Solution (Python):
n,m,x,y=map(int,input().split())
n_lst=list(map(int,input().split()))
m_lst=list(map(int,input().split()))
flag=0
n_max=max(n_lst)
m_min=min(m_lst)

for i in range(x+1,y+1):
    if n_max<i<=m_min:
        flag=1
print('No War') if flag==1 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):
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()

x_max = x[0]
y_min = y[0]
result = "War"
for z in range(X+1,Y+1):
    if x_max < z <= y_min:
        result = "No War"
        break

print(result)

Solution (Python):
n, m, x, y = map(int, input().split())
xc = list(map(int, input().split()))
yc = list(map(int, input().split()))
xc.append(x)
yc.append(y)
xc.sort(reverse=True)
yc.sort()
if xc[0] < yc[0]:
    print("No War")
else:
    print("War")

Solution (Python):
import numpy as np

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()]

min_x = np.min(x)
max_x = np.max(x)
min_y = np.min(y)
max_y = np.max(y)

if(X < Y): 
    if((max_x < min_y) and (max_x < Y) and (min_y > X)):
        print("No War")
    else:
        print("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()]
war = True

for Z in range(X + 1, Y+1):
    if max(x) < Z <= min(y):
        war = False
        break

if war:
    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()]

war = True

for Z in range(X + 1, Y + 1):
    if max(x) < Z <= min(y):
        war = False
        break

print("War" if war else "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()]

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

Solution (Python):
n,m,XX,YY=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
x.sort()
y.sort()
result=False
if x[-1]<=y[0]:
    for i in range(XX+1,YY+1):
        if i>x[-1] and i<=y[0]:
            result=True
if result==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()))

z_kouho = [i for i in range(X+1, Y+1) if max(x) < i <= min(y)]
if z_kouho:
    ans = "No War"
else:
    ans = "War"
print(ans)

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

x_max = max(x_list)
y_min = min(y_list)

if x_max < y_min and x < x_max and y>= y_min:
    print("No War")
else:
    print("War")

Solution (Python):
import sys

def main():
  input = sys.stdin.readline
  N, M, X, Y = map(int, input().split())
  Xi = [X] + list(map(int, input().split()))
  Yi = [Y] + list(map(int, input().split()))
  
  Xi, Yi = sorted(Xi), sorted(Yi)
  if Xi[-1] < Yi[0]:
    print('No War')
  else:
    print('War')


if __name__ == '__main__':
  main()

Solution (Python):
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
if x<min(Y)<=y and max(X)<min(Y):
  print('No War')
else:
  print('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())))

for i in range(X+1, Y+1):
  if(x[-1] < i <= y[0]):
    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(" ")))

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

Solution (Python):
class Solver(object):
    def __init__(self):
        self.n, self.m, self.x, self.y = list(map(int, input().split(" ")))
        self.x_s = list(map(int, input().split(" ")))
        self.y_s = list(map(int, input().split(" ")))

    def solve(self):
        self.x_s.append(self.x)
        self.x_s.sort()
        self.y_s.append(self.y)
        self.y_s.sort()
        max_x = max(self.x_s)
        min_y = min(self.y_s)

        for z in range(self.x+1, self.y+1):  
            if (max_x < z) and (min_y >= z):
                print("No War")
                return
        
        print("War")


if __name__ == "__main__":
    s = Solver()
    s.solve()

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())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(max(x)+1,min(y)+1):
    if X < i <= Y:
        print("No War")
        exit()
print("War")

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

for i in range(x+1,y+1):
    cnt = 0
    for j in range(n):
        if xn[j] < i:
            cnt += 1

    for j in range(m):
        if ym[j] >= i:
            cnt += 1
    
    if cnt == n+m:
        print('No War')
        break    
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()))

c = []
for i in range(x+1,y+1):
    cnt = 0
    for j in range(n):
        if xn[j] < i:
            cnt += 1

    for j in range(m):
        if ym[j] >= i:
            cnt += 1
    c.append(cnt)
    
if n+m in c:
    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_max = x
y_min = y


for i in range(n):
    if x_list[i] > x_max:
        x_max = x_list[i]


for i in range(m):
    if y_list[i] < y_min:
        y_min = y_list[i]

if x_max < y_min:
    ans = "No War"
else:
    ans = "War"


print(ans)

Solution (Python):
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)
if max(a) < min(b):
    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)
X.sort()
Y.sort()
if X[len(X)-1] < Y[0]:
    print("No War")
else:
    print("War")

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

x_arr.append(x)
y_arr.append(y)

if max(x_arr) < min(y_arr):
    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)

xList = [int(x) for x in input().split()]
yList = [int(y) for y in input().split()]
xList.sort()
yList.sort()

if max(xList[-1], X) < min(yList[0], Y):
    print('No War')
else:
    print('War')

Solution (Python):



from sys import stdin
import numpy as np



N,M, X,Y = map(int, raw_input().split())
x_max = max( map(int, raw_input().split()) )
y_min = min( map(int, raw_input().split()) )

if X <= x_max < y_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(x)
min_y = min(y)
flag = False
for i in range(X+1,Y+1):
  if (max_x < i <= min_y):
    flag = True
    break
  else:
    flag = False
if flag == True:
  print("No War")
else:
  print("War")

Solution (Python):
n, m, x, y = list(map(int, input().split()))
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
xl.append(x)
yl.append(y)

if max(xl) < min(yl):
    print("No War")
else:
    print("War")

Solution (Python):
import numpy as np
n, m, x, y = list(map(int, input().split()))
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]

if x > y:
    print("War")
else:
    zl = np.arange(x+1, y+1)
    for z in zl:
        if (max(xl) < z) & (z <= min(yl)):
            print("No War")
            break
    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(x)
min_y = min(y)
for i in range(X+1, Y+1):
  if(max_x < i <= min_y):
    print("No War")
    break
else:
  print("War")

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

flag = False
for i in range(-99, 101):
    if x < i and i <= y:
        for j in x_lst:
            if j < i:
                continue
            else:
                break
        else:
            for k in y_lst:
                if i <= k:
                    continue
                else:
                    break
            else:
                flag = True
                
print('No War') if flag else print('War')

Solution (Python):
import sys

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

for z in range(x + 1, y + 1):
    if max(x_list) < z:
        if min(y_list) >= z:
            print("No War")
            sys.exit(0)

print("War")

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

x_li = list(map(int,input().split()))
y_li = list(map(int,input().split()))

flag = 0
for i in range(x+1,y+1):
    if max(x_li) < i:
        if min(y_li) >= i:
            flag = 1

print(['War','No War'][flag])

Solution (Python):
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
ans = False
for i in range(X+1,Y-1):
    if max(x)<i and min(y)>=i:
        ans = True
        break
if ans == False:
    print("War")
else:
    print("No War")

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

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

Solution (Python):
hoge = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
Y = [int(i) for i in input().split()]
X.append(hoge[2])
Y.append(hoge[3])
X.sort()
Y.sort()
 

if(Y[0]-X[-1]>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()))

if max(x)<min(y):
  for i in range(max(x)+1,min(y)+1):
    if i>X and i<=Y:
      print('No War')
      break
  else:
    print('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)+1)>min(y) or (X+1)>Y):
  print('War')
else:
  print('No 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()))

for i in range(max(x_list)+1,min(y_list)+1):
  if i > X and i <= Y and max(x_list) < i and min(y_list) >= i:
    print('No War')
    break
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()))
print("War" if min(y)<=max(x) or min(y)<=X or max(x)>=Y else "No 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) or max(x)>=Y or min(y)<=X:
    print("War")
else:
    print("No War")

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

Z = range(X + 1, Y + 1)

flag = 'War'

for z in Z:
  if x[-1] < z and y[0] >= z:
    flag = 'No War'
    break

print(flag)

Solution (Python):


def main():
    [N, M, X, Y] = list(map(int, input().split()))
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))

    x.append(X)
    y.append(Y)
    max_x = max(x)
    min_y = min(y)

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


if __name__ == '__main__':
    main()

Solution (Python):


II = lambda: int(input())
MI = lambda: map(int, input().split())


def main():
    N, M, X, Y = MI()
    x = max(MI())
    y = min(MI())
    if not x < Y: return False
    if not X < y: return False
    if not x < y: return False
    return True


if __name__ == "__main__":
    print(["War", "No War"][main()])

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

if max(x) < min(y) and X < min(y) <= Y:
    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()]
A =max(x)
B =min(y)
if X <= A < B and B <= 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()
for Z in range(max(X, x[-1]), min(Y, y[0])+1):
    if X < Z <= Y and x[-1] < Z <= y[0]:
        print('No War')
        break
else:
    print('War')

Solution (Python):
N,M,X,Y=(int(i) for i in input().split())
xlist=[int(i) for i in input().split()]
ylist=[int(i)for i in input().split()]
xmax=max(xlist)
ymin=min(ylist)
if xmax<ymin:
  if xmax<Y and X<ymin:
    print('No War')
  else:
    print('War')
else:
  print('War')

Solution (Python):
n,m,X,Y=[int(x) for x in input().split()]
x=[int(x) for x in input().split()]
y=[int(x) for x in input().split()]
zmax=min(Y,min(y))
zmin=max(X+1,max(x)+1)
if zmax<zmin:
    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()]
x.append(X)
y.append(Y)
if min(y)-max(x)>0:
    print("No War")
else:
    print("War")

Solution (Python):
""" AtCoder """

import sys
input = sys.stdin.readline

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):
def main():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    for t in range(X + 1, Y + 1):
        if t > max(x) and min(y) >= t:
            print('No War')
            exit()
    print('War')


main()

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

lix=list(map(int,input().split()))
liy=list(map(int,input().split()))

if (min(liy))>(max(lix)) and max(lix)<y and min(liy)>x :
  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()]
X.append(x)
Y.append(y)

if max(X) < min(Y):
    print('No War')
else:
    print('War')

Solution (Python):
import numpy as np
import sys

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()]
x.append(X)
y.append(Y)
x.sort()
y.sort()

if(x[N]>=y[0]):
    print("War")
    sys.exit()
print("No War")

Solution (Python):
n, m, x, y = [int(x) for x in input().split()]
xlist = [int(x) for x in input().split()]
ylist = [int(x) for x in input().split()]

if max(xlist) >= min(ylist):
    print('War')
elif min(ylist) <= x or y < min(ylist):
    print('War')
else:
    print('No War')

Solution (Python):

n,m,x,y = list(map(int, input().split(' ')));
xn = list(map(int, input().split(' ')));
yn = list(map(int, input().split(' ')));

xmax = max(xn)
ymin = min(yn)





if ( xmax < ymin and xmax < y and x < ymin ):
    print( 'No War' )
else:
    print( 'War' )

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

Solution (Python):
N, M, X, Y = map(int, str(input()).split())
x = max([i for i in map(int, str(input()).split())])
y = min([i for i in map(int, str(input()).split())])
print("No War" if (x < Y and X < y) and x < y else "War")

Solution (Python):
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()]
ans='War'
for Z in range(-100,101):
    if(X<Z<=Y 
        and all([x[i]<Z for i in range(N)]) 
        and all([y[i]>=Z for i in range(M)])
    ):
        ans ='No War'
        break
print(ans)

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

Solution (Python):
def main(x,y,xlst,ylst):
    xlst.append(x)
    ylst.append(y)
    xmax =max(xlst)
    ymin = min(ylst)
    if xmax<ymin:
        print("No War")
    else:
        print("War")
n,m,x,y = map(int,input().split())
xlst = list(map(int,input().split()))
ylst = list(map(int,input().split()))
main(x,y,xlst,ylst)

Solution (Python):
xy=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]+[xy[2]]
y=[int(i) for i in input().split()]+[xy[3]]
x.sort()
y.sort()
if x[-1]<y[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()))

print(["War","No War"][X<min(y) and max(x)<Y and max(x)<min(y)])

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

Solution (Python):


def main():
    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)
    if max(xs) < min(ys):
        print("No War")
    else:
        print("War")

main()

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

war = True
for i in range(X+1,Y+1):
    if x[-1] < i and y[0] >= i:
        war = False
        break
print('War' if war else 'No War')

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

    max_x = max(list(dx))
    min_y = min(list(dy))

    z = x + 1
    while z <= y:
        if z > max_x and z <= min_y:
            
            print("No War")
            exit()
        z += 1
    print("War")


def main2():
    n, m, x, y = map(int, input().split())
    dx = map(int, input().split())
    dy = map(int, input().split())

    dx = list(dx)
    dy = list(dy)

    dx.append(x)
    dy.append(y)

    if max(dx) < min(dy):
        print("No War")
    else:
        print("War")


if __name__ == '__main__':
    main2()

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

    max_x = max(list(dx))
    min_y = min(list(dy))
    
    
    

    z = x + 1
    while z <= y:
        if z > max_x and z <= min_y:
            
            print("No War")
            exit()
        z += 1
    print("War")


if __name__ == '__main__':
    main()

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

    max_x = max(list(dx))
    min_y = min(list(dy))
    if x >= y:
        print("WAR")
        exit()

    z = x + 1
    while z <= y:
        if z > max_x and z <= min_y:
            
            print("No War")
            exit()
        z += 1
    print("War")


if __name__ == '__main__':
    main()

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

if X >= Y:
    print('War')
else:
    for Z in range(X+1,Y+1):
        if max(x) < Z and Z <= min(y):
            print('No War')
            exit()
    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):
    ans = 'No War'
else:
    ans = 'War'

print(ans)

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

Solution (Python):
S = list(map(int,input().split()))
N = S[0]
M = S[1]
X = S[2]
Y = S[3]
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
x_max = max(x)
y_min = min(y)
if x_max < y_min:
    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(x)
min_y = min(y)
for i in range(X+1,Y+1):
  if(max_x < i <= min_y):
    print('No War')
    break
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()))

Z = min(y)
if max(x) < Z and X < Z and Z <= 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_max = max(x_list)
y_min = min(y_list)

war_flag = True
for z in range(x_max + 1, y_min + 1):
    if X < z <= Y:
        war_flag = False
        break

if war_flag:
    print("War")
else:
    print("No War")

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

x_max = max(map(int, raw_input().split(" ")))
y_min = min(map(int, raw_input().split(" ")))

if x <= x_max < y_min <= y:
    print("No War")
else:
    print("War")

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

x.sort()
y.sort()

for i in range(X+1,Y+1):
    if(x[-1]<i and y[0]>=i):
        count+=1

if(count>0):
    print("No War")
else:
    print("War")

Solution (Python):
n, m, x, y = map(int, input().split())
liX = map(int, input().split())
liY = map(int, input().split())
for i in range(max(liX) + 1, min(liY) + 1):
    if x < i <= y:
        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()))
Z = [z for z in range(-100, 101) if (X < z <= Y) and (max(x) < z <= min(y))]
if len(Z) is not 0: print('No War')
else: print('War')

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

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

l = max(x)
r = min(y)
if l<r and l<Y and X<r:
    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()))
a_max = max(a)
b_min = min(b)
for i in range(x+1,y+1):
    if a_max < i and b_min >= i:
        print('No War')
        exit()
print('War')

Solution (Python):

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

x = max(list(map(int, input().split())) + [X])
y = min(list(map(int, input().split())) + [Y])

ans = "War"
if x < y:
        ans = "No War"
print(ans)

Solution (Python):

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

lst_x = list(map(int, input().split()))
lst_x.append(X)
lst_y = list(map(int, input().split()))
lst_y.append(Y)

x = max(lst_x)
y = min(lst_y)

ans = "War"
if x < y:
        ans = "No War"
print(ans)

Solution (Python):

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

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

ans = "War"
for z in range(X+1, Y+1):
    if x < z <= y:
        ans = "No 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()))

mx = max(x)
my = min(y)

flag = False
for z in range(X+1,Y+1):
    if mx<z and z<=my:
        flag=True

if flag:
    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 min(y) >= max(x)+1:
  print("No War")
else:
  print("War")

Solution (Python):
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))+[X]
y=list(map(int,input().split()))+[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()))
print("No War" if max(max(x),X)<min(min(y),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.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 = [0]*N
y = [0]*M
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 = list(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] and y[0] <= Y and y[0] > X:
    ans = 'No War'
else:
    ans = 'War'

print(ans)

Solution (Python):
n, m, x, y = map(int, input().split())
lx = list(map(int, input().split()))
ly = list(map(int, input().split()))
if (max(lx+[x]) < min(ly+[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) < Y:
    print('No War')
else:
    print('War')

Solution (Python):
n, m, x, y = [int(i) for i in input().split()]
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]
xma, ymi = max(xl), min(yl)
for z in range(x+1,y+1):
    if xma < z <= ymi:
        print("No War")
        break
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()))
cnn=-1
for Z in range(-100,101):
    if (x<Z and Z<=y):
        cnt = 0
        for i in range(0,N):
            if (X[i]<Z):
                cnt = cnt + 1 
                if (cnt == N):
                    cnt=0
                    for r in range(0,M):
                        if (Z<=Y[r]):
                            cnt=cnt+1
                            if (cnt==M):
                                cnn= cnn+1
                                if (cnn==0):
                                    print ("No War")                 
            
if(cnn == -1):
    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 Z in range(max(x)+1, min(y)+1):
    if X < Z <= Y:
        print("No War")
        exit()
else:
    print("War")

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

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

maX = max(X)
miY = min(Y)

ans = ""
if maX < miY:
    ans = "No War"
else:
    ans = "War"

print(ans)

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

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

x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))

x_list.append(int(X))
y_list.append(int(Y))

if int(max(x_list)) < int(min(y_list)):
    print("No War")
else:
    print("War")

Solution (Python):
a = [int(i) for i in input().split()] 
b = [int(i) for i in input().split()] 
c = [int(i) for i in input().split()] 
b.append(a[2])
c.append(a[3])
if max(b) >= min(c):
 print('War')
else:
 print('No War')

Solution (Python):



def main():
    """Function."""
    n, m, x, y = map(int, input().split())

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

    x_val = max(xs)
    y_val = min(ys)

    flag = 0
    if x >= y_val or y <= x_val:
        flag = 1
    elif y_val <= x_val:
        flag = 1
    else:
        pass

    if flag == 1:
        print("War")
    else:
        print("No War")


if __name__ == "__main__":
    main()

Solution (Python):
H, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
 
r = any(all(i < z for i in x) and all(i >= z for i in y) for z in range(X+1, Y+1))
print("No War" if r else "War")

Solution (Python):
NMXY = list(map(int, input().split()))
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))

if max(xlist) < min(ylist) and NMXY[2] < NMXY[3] and max(xlist) < NMXY[3] and NMXY[2] < min(ylist):
    print('No War')
else:
    print('War')

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


if __name__ == '__main__':
    main()

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

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

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

if(x_max<y_min and X < y_min<=Y):
    print("No War")
else:
    print("War")

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

if max(X) < min(Y):
    print('No War')
else:
    print('War')