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



Sample input:
3 2 10 20
8 15 13
16 22


Sample output:
No War

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x_max = max(x)
y_min = min(y)
X = a[2]
Y = a[3]
check = 'War'
for i in range(X+1,Y+1):
    if (x_max < i) and (y_min >= i):
        check = 'No War' 
print(check)

Submission status: Accepted

Solution code:
from sys import stdin

input = lambda: stdin.readline()

def main():
    N, M, X, Y = map(int, input().split())
    Xn = list(map(int, input().split()))
    Ym = list(map(int, input().split()))


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

main()

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,raw_input().split())
x=map(int,raw_input().split())
y=map(int,raw_input().split())

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

if y_min-x_max>=1:
	for i in range(x_max+1,y_min+1):
		if X<i<=Y:
			print "No War"
			quit()
	else:
		print "War"
	
else:
	print "War"

Submission status: Accepted

Solution code:
N, M, X, Y = [int(i) for i in input().split()]
x_pos = sorted([int(i) for i in input().split()])
y_pos = sorted([int(i) for i in input().split()])

interbal = range(X + 1, Y + 1)
ans = 'War'
for z in interbal:
    if max(x_pos) < z <= min(y_pos):
        ans = 'No War'
        break
print(ans)

Submission status: Accepted

Solution code:


N, M, X, Y = list(map(int, input().split()))
a = []
for i in range(2):
    a.append(list(map(int, input().split())))

if X < Y:
    xs = sorted(a[0])
    ys = sorted(a[1])
    if xs[-1] < ys[0] and xs[-1] < Y and ys[0]>X:
        print('No War')
    else:
        print('War')
else:
    print('War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-

def main():
    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 all(x < z for x in x_list) and all(y >= z for y in y_list):
            print('No War')
            exit()
    print('War')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8

nmxy = input().split(" ")
n = int(nmxy[0])
m = int(nmxy[1])
xc = int(nmxy[2])
yc = int(nmxy[3])
x_list = [int(s) for s in input().split(" ")]
y_list = [int(s) for s in input().split(" ")]
x_list.append(xc) 
y_list.append(yc)
x_list.sort(reverse=True)
y_list.sort()

if x_list[0] < y_list[0]:
  print("No War")
else:
  print("War")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
inputs = list(map(int, input().split()))
N = inputs[0]
M = inputs[1]
X = inputs[2]
Y = inputs[3]

Xposi = list(map(int, input().split()))
Yposi = list(map(int, input().split()))

Xposi.sort()
Yposi.sort()

if X<Y and  Xposi[-1] < Y and X < Yposi[0]  and Xposi[-1] < Yposi[0]:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

  x = sorted(x)
  y = sorted(y)
  
  if x[-1] < y[0]:
    # Zが存在する
    if X < y[0] <= Y:
      print('No War')
    else:
      print('War')
  else:
    print('War')


solve()

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))

for i in range(x+1, y+1):
    if all([j < i for j in xlist]) and all([k >= i for k in ylist]):
        print("No War")
        break
else:
    print("War")

Submission status: Accepted

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

for i in list(map(int, input().split())):
    z = max(z, i)
z += 1

if z > y:
    print("War")
else:
    for i in list(map(int, input().split())):
        if z > i:
            print("War")
            break
    else:
        print("No War")

Submission status: Accepted

Solution code:
def main():
    """
    """
    N, M, X, Y = map(int, input().split())
    *x, = map(int, input().split())
    *y, = map(int, input().split())

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if max(x) >= min(y):
	print("War")
	exit()

z = [i+1 for i in range(max(x),min(y))]

for Z in z:
	if X < Z <= Y:
		print("No War")
		exit()

print("War")

Submission status: Accepted

Solution code:
n,m,nx,ny = map(int, input().split())

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

x.sort()
y.sort()

if (x[n-1] < y[0]) and (nx < y[0]) and (x[n-1] < ny) and (nx < ny) :
   print('No War')
else :
   print('War')

Submission status: Accepted

Solution code:
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 ( min(y) >= Z):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
def main():
    data = list(map(int, input().split()))
    Xn = data[0]
    Yn = data[1]
    X = data[2]
    Y = data[3]

    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))

    mergin = list(range(X, Y))
    x_line = min(mergin)
    y_line = max(mergin)

    max_x = max(Xs)
    min_y = min(Ys)

    if (max_x < min_y):
        if ((max_x + min_y) // 2 in mergin):
            print('No War')
        else:
            print('War')
    else:
        print('War')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
[N,M,X,Y] = [int(x) for x in input().split()]
xs  = [int(x) for x in input().split()] + [X]
ys  = [int(x) for x in input().split()] + [Y]

nowar = max(xs) <  min(ys)

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

Submission status: Accepted

Solution code:
# coding:utf-8

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)
xSorted = sorted(xlist)
ySorted= sorted(ylist)

xMax = xSorted[-1]
yMin = ySorted[0]

if xMax < yMin:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

if Y - X > 0 and X <= max(xns)  and min(yns) <= Y and min(yns) - max(xns) > 0:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
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):
    if X < min(y):
        if max(x) < Y:
            print('No War')
            quit()
print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int, input().split(" "))
X=list(map(int, input().split(" ")))
Y=list(map(int, input().split(" ")))
flag=0
#print(max(X),min(Y))
for i in range(x+1,y+1):
    #print(i)
    if (max(X) < i) and (min(Y) >= i):
        #print(i)
        flag=1
        break
if flag==1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
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_max = max(lx)
ly_min = min(ly)

if lx_max >= ly_min:
  print('War')
else:
  print('No War')

Submission status: Accepted

Solution code:
def run(N, M, X, Y, x, y):
    x.append(X)
    y.append(Y)
    max_x = max(x)
    min_y = min(y)
    if max_x < min_y:
        ret = 'No War'
    else:
        ret = 'War'
    return ret


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
res = "War"
flag = 0
if Y > X:
    for i in range(X+1, Y+1):
        if x[-1] < i <= y[0]:
            res = "No War"
            flag = 1
            break
    if flag == 1:
        print("No War")
    else:
        print("War")
else:
    print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, raw_input().split(' '))
Xs = sorted(map(int, raw_input().split(' ')) + [X])
Ys = sorted(map(int, raw_input().split(' ')) + [Y])

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

Submission status: Accepted

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

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

rightX = max(xs)
leftY = min(ys)

z = leftY

if x < z <= y and rightX < z:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

xs.sort()
xs.reverse()
ys.sort()

if(xs[0] >= ys[0]):
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split(" "))
Xs = [int(a) for a in input().split()]
Ys = [int(a) for a in input().split()]
maxX = X
minY = Y
for i in Xs:
    if i>maxX:
        maxX = i

for i in Ys:
    if i<minY:
        minY = i
        
if maxX < minY:
    print ("No War")
else:
    print ("War")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

xak = list(map(int,input().split(" ")))
yak = list(map(int,input().split(" ")))

x_max = max(xak)
y_min = min(yak)

if x_max >= y_min:
    print("War")
else:
    for i in range(x_max+1,y_min+1):
        if x < i <= y:
            print("No War")
            break
    else:
        print("War")

Submission status: Accepted

Solution code:
import numpy as np,math,itertools

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

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

for i in range(-100,100):
   if not x<i<=y:continue
   if all([I<i for I in xs])and all([I>=i for I in ys]):rs=True;break

print(["War","No War"][int(rs)])

Submission status: Accepted

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

max_x = max(x)
min_y = min(y)

for i in range(yy):
  if max_x < i and i <= min_y and xx<i<=yy:
    print("No War")
    break
else:
  print("War")

Submission status: Accepted

Solution code:
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[-1] < y[0] and X < y[0] and Y > x[-1]:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
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(reverse=True)
y.sort()

Z = y[0]
ans = "War"
if X < Z <= Y:
    if x[0] < Z:
        ans = "No War"

print(ans)

Submission status: Accepted

Solution code:
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 Y-X <= 0 or x[-1] >= Y or y[0] <= X or x[-1] >= y[0]:
  print("War")
else:
  print("No War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xarray = sorted([int(x) for x in input().split()])
yarray = sorted([int(x) for x in input().split()])

res = "War"
if xarray[-1] > yarray[0]:
    res = "War"
else:
    for i in range(xarray[-1], yarray[0]+1):
        if x < i <= y and xarray[-1] < i <= yarray[0]:
            res = "No War"
            break
print(res)

Submission status: Accepted

Solution code:
_, _, x, y = map(int, input().split())
x_cities = map(int, input().split())
y_cities = map(int, input().split())

max_x, min_y = max(x_cities), min(y_cities)
if max_x < min_y and x < min_y < y:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = sorted(map(int, input().split()))
y = sorted(map(int, input().split()))
for Z in range(X+1, Y+1):
    if x[-1] < Z and y[0] >= Z:
        print("No War")
        break
else:
    print("War")

Submission status: Accepted

Solution code:
n, m, x0, y0 = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(x0)
y.append(y0)

x.sort()
y.sort()

if x[-1] < y[0]:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
def ketanowa(p):
    ans = 0
    p = str(p)
    for i in p:
        ans += int(i)
    return ans


def main():
    temp=input()
    temp=list(map(int,list(temp.split(" ")))) 
    X = temp[2]
    Y = temp[3]
    temp=input()
    temp=list(map(int,list(temp.split(" ")))) 
    x = max(temp)
    temp=input()
    temp=list(map(int,list(temp.split(" ")))) 
    y = min(temp)
    for z in range(X+1,Y+1):
        if x < z and z<=y:
            print("No War")
            return 0
    
    print("War")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
nums = [int(num) for num in input().split()]
n = nums[0]
m = nums[1]
x = nums[2]
y = nums[3]
maxx =-100
miny =100
hogex = [int(num) for num in input().split()]
hogey = [int(num) for num in input().split()]
for i in range(n):
    maxx = max(hogex[i],maxx)
for i in range(m):
    miny = min(miny,hogey[i])

if maxx < y and miny >x and maxx <miny:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))
ans = "War"
for i in range(x+1, y+1):
    if i > max(xn):
        if i <= min(yn):
            ans = "No War"
            break
print(ans)

Submission status: Accepted

Solution code:
import sys

N, M, X, Y = list(map(int, sys.stdin.readline().strip().split(" ")))
x_list = list(map(int, sys.stdin.readline().strip().split(" ")))
y_list = list(map(int, sys.stdin.readline().strip().split(" ")))

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

for Z in range(X+1, Y+1):
    if x_max < Z and y_min >= Z:
        print("No War")
        sys.exit()
print("War")

Submission status: Accepted

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

x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]

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

if max(X,mx)<min(Y,my):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
ans = "War"
for Z in range(X+1,Y+1):
    if max(x) < Z and min(y) >= Z:
        ans = "No War"
print(ans)

Submission status: Accepted

Solution code:
from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def yes(n): print("Yes" if n else "No")
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

n,m,X,Y = f()
x = f()
y = f()
max_x = max(x)
min_y = min(y)
if min_y - max_x >= 1:
    for i in range(max_x+1, min_y+1):
        if X < i <= Y:
            print("No War")
            break
    else:
        print("War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = sorted(list(map(int, input().split())))
y = sorted(list(map(int, input().split())))
if X < Y and x[-1] < y[0]:
    for i in range(N):
        if x[i] >= Y:
            print("War")
            exit()
    for i in range(M):
        if y[i] <= X:
            print("War")
            exit()
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, raw_input().split())
x = map(int, raw_input().split())
y = map(int, raw_input().split())

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

Submission status: Accepted

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

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

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


for Z in range(-100,101):
    if X<Z<=Y and x_max < Z and y_min>=Z:
        print("No War")
        exit()

else:
    print("War")

Submission status: Accepted

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

for i in range(X+1, Y+1):
    for x in x_list:
        if x >= i:
            break
    else:
        for y in y_list:
            if y < i:
                break
        else:
            print("No War")
            exit()
print("War")

Submission status: Accepted

Solution code:
n, m , x, y = map(int, input().split())
X = [int(_)  for _ in input().split()]
Y = [int(_)  for _ in input().split()]
maxX = max(X)
maxX = max(maxX, x)
minY = min(Y)
minY = min(minY, y)
if minY - maxX >= 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

x_l = list(map(int, input().split()))
y_l = list(map(int, input().split()))

xm = max(x_l)
ym = min(y_l)

ans = 'No War'

if xm >= ym:
    ans = 'War'

elif xm >= Y:
    ans = 'War'

elif X >= ym:
    ans = 'War'

elif X >= Y:
    ans = 'War'

print(ans)

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, raw_input().split(' '))
Xs = sorted(map(int, raw_input().split(' ')))
Ys = sorted(map(int, raw_input().split(' ')))

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))

ans = False

for z in range(X+1,Y+1):
    x_flag = [x < z for x in x_list]
    y_flag = [y >= z for y in y_list]
    if sum(x_flag) == len(x_flag) and sum(y_flag) == len(y_flag):
        ans = True
        break

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

Submission status: Accepted

Solution code:
nmxy = list(map(int, input().split()))
n = nmxy[0]
m = nmxy[1]
x = nmxy[2]
y = nmxy[3]
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")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from itertools import takewhile
def solve():
    N,M,X,Y = list(map(int, input().split()))
    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))
    X1 = max(Xs)
    Y1 = min(Ys)
    Z0 = set(range(X+1, Y+1))
    Z1 = set(range(X1+1, Y1+1))
    Z = Z0&Z1
    if Z:
        res = "No War"
    else:
        res = "War"
    return str(res)

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, X, Y, x, y):
    mx = max(x)
    my = min(y)

    error_print(mx, my)
    if mx < my and (my > X and mx < Y):
        return 'No War'
    return 'War'


def main():
    N, M, X, Y = read_int_n()
    x = read_int_n()
    y = read_int_n()
    print(slv(N, M, X, Y, x, y))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = map(int, input().split())
y = map(int, input().split())
max_x = max(x)
min_y = min(y)
if min_y <= max_x or min_y <= X or Y <= max_x:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
N, M, X, Y = [int(elem) for elem in input().split(' ')]
x_list = [int(elem) for elem in input().split(' ')]
assert len(x_list)== N
y_list = [int(elem) for elem in input().split(' ')]
assert len(y_list) == M

max_x = max(x_list)
min_y = min(y_list)

for Z in range(X + 1, Y + 1):
    if (max_x < Z and Z <= min_y):
        print("No War")
        break
    else:
        continue
else:
    print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())		# 5 7

x = sorted(list( map(int, input().split()) ))	# 1 2 3 4 5 ...(ソート付き)
y = sorted(list( map(int, input().split()) ))	# 1 2 3 4 5 ...(ソート付き)

x.append(X)
x.sort()

y.append(Y)
y.sort()


if x[N]<y[0]:
	print("No War")
else:
	print("War")

Submission status: Accepted

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

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

Submission status: Accepted

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

X2 = X.copy()
X2.append(x)
X2.sort()

Y2 = Y.copy()
Y2.append(y)
Y2.sort()

if X2[-1] < Y2[0]:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

Z=y[0]

if x[0]>=Z:
    print("War")
elif X>=Z:
    print("War")
elif Z>Y:
    print("War")
else:
    print("No War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():
    n, m, x, y = list(map(int, input().split()))
    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))
    Xs.append(x)
    Ys.append(y)
    Xs.sort()
    Ys.sort()

    if Xs[-1]+1 <= Ys[0]:
        print("No War")
        exit()
    print("War")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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):
    t = 1
    for p in range(N):
        if x[p] >= z:
            t = 0
            break
    for q in range(M):
        if y[q] < z:
            t = 0
            break
    if t == 1:
        print("No War")
        exit(0)
print("War")

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
xs = list(map(int,input().split()))
ys = list(map(int,input().split()))
mx = max(xs)
mx = max(mx,X)
my = min(ys)
my = min(my,Y)
if mx >= my: 
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
Xi = [int(_) for _ in input().split()]
Yi = [int(_) for _ in input().split()]
Xi.append(X)
Yi.append(Y)
print("War" if max(Xi) >= min(Yi) else "No War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
lis = list(map(int,input().split()))
li = list(map(int,input().split()))
for i in range(-100,300):
  if max(lis) < i and i <= min(li):
    if x < i and i <= y:
      print("No War")
      exit()
print("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
a = 1
x.sort()
y.sort()
ans = -1
for i in range(X + 1, Y + 1):
    if x[-1] < i <= y[0]:
        ans = 1
if ans == 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int,input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
xl.sort()
yl.sort()
if xl[n-1] < yl[0] and x < yl[0] and xl[n-1] < y:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

def f():
    mxx = max(Xx)
    mny = min(Yy)
    for z in range(Y, X, -1):
        if mxx < z and z <= mny:
            return "No War"
    return "War"
print(f())

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

Solution code:
N,M,X,Y=input().split()
X=int(X)
Y=int(Y)
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")

Submission status: Accepted

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

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

for Z in range(x + 1, y + 1):
    if X < Z <= Y:
        print('No War')
        quit()

print('War')

Submission status: Accepted

Solution code:
import sys
one=list(map(int,input().split()))
two=list(map(int,input().split()))
two.sort()
three=list(map(int,input().split()))
three.sort()
for i in range(one[2]+1,one[3]+1):
    if two[-1]<i and three[0]>= i:
        print("No War")
        sys.exit()
print("War")

Submission status: Accepted

Solution code:
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 = list(range(max(X, x[-1])+1, min(Y, y[0])+1))

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

Submission status: Accepted

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

xl = list(map(int,input().split()))
yl = list(map(int,input().split()))

if y-x < 0:
    print('War')
    exit()

z = [i for i in range(x+1,y+1)]
#print(z)

flag = 0

for i in z:
    if max(xl) + 1 <= i and i <= min(yl):
        flag=1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m, x, y = [int(s) for s in input().split()]
lx = [int(s) for s in input().split()]
ly = [int(s) for s in input().split()]
lx.append(x)
ly.append(y)
mx = max(lx)
my = min(ly)
print("No War" if mx < my else "War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
left = list(map(int, input().split()))
right = list(map(int, input().split()))

max_l = max(left)
min_r = min(right)

flag = 0

for i in range(-100, 101):
  if X < i <= Y and max_l < i <= min_r:
    print("No War")
    flag = 1
    break
    
if not flag:
  print("War")

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x_l=list(map(int,input().split()))
y_l=list(map(int,input().split()))
if max(x_l)<min(y_l) and X<min(y_l) and max(x_l)<Y:print("No War")
else:print("War")

Submission status: Accepted

Solution code:

N, M , X, Y = [int(i) for i in input().split(' ')]
xs = [int(i) for i in input().split(' ')]
ys = [int(i) for i in input().split(' ')]
mx = max(xs+[X])
my = min(ys+[Y])
if my > mx:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
[n,m,xp,yp]=[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(xp)
y.append(yp)

xma=max(x)
ymi=min(y)


if xma < ymi:
    print("No War")
else:
    print("War")