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

Submission status: Accepted

Solution code:
# Xとx_iを同一視する。
n, m, x, y = map(int, input().split())
x_list = [int(_) for _ in input().split()]
x_list.append(x)
y_list = [int(_) for _ in input().split()]
y_list.append(y)
x_max = max(x_list)
y_min = min(y_list)
if x_max < y_min:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(map(int,input().split()))
x=list(map(int,input().split()))
y=list(map(int,input().split()))
ma, mi = -10000, 10000
for i in x:
    ma = max(ma, i)
for j in y:
    mi = min(mi, j)
ma = max(ma, s[2])
mi = min(mi, s[3])
if (ma < mi):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

xline = list(map(int,input().split()))
yline = list(map(int,input().split()))

a = max(xline)
b = min(yline)

if (b > a) and (a < Y) and (b > X):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
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) and x < min(b) and max(a) < y:
    print ("No War")
else:
    print ("War")

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, raw_input().split())
xlst = map(int, raw_input().split())
ylst = map(int, raw_input().split())
xlst.sort()
ylst.sort()
ans = 'War'
if xlst[N-1] < Y and X < ylst[0] and xlst[N-1] < ylst[0]:
	ans = 'No ' + ans

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.append(X)
y.append(Y)
if max(x) >= min(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()))
last_x = sorted(x)[-1]
farst_y = sorted(y)[0]
if (last_x < Y) and (X < farst_y) and (last_x < farst_y):
  print("No War")
else:
  print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
result = True

if max(x) < min(y):
     # print("max(x)=", max(x))
     # print('min(y)=', min(y))
     range(max(x), min(y))
     
     for i in range(max(x)+1, min(y)+1):
          if i > max(x) and i <= min(y):
               if i > n[2] and i <= n[3]:
                    print("No War")
                    result = False
                    break
     if result:
          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)
 
print('No War' if max(x) < min(y) else '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)

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
xls = list(map(int, input().split()))
yls = list(map(int, input().split()))
xls.sort(reverse=True)
yls.sort()
if xls[0] < yls[0] and X < yls[0] and xls[0] < Y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
#AtCorder Beginner Contest 110 B 1 Dimensional World's Tale
import sys
N,M,X,Y = input().split()

X = int(X)
Y = int(Y)

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

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

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

Submission status: Accepted

Solution code:
_, _, X, Y = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

xmax = max(xs + [X])
ymin = min(ys + [Y])
print('War' if (ymin <= xmax) else 'No War')

Submission status: Accepted

Solution code:
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)
for i in range(x+1,y+1):
  if max(a) < i <= min(b):
    print("No War")
    break
else:
  print("War")

Submission status: Accepted

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

enpire_A = input().split()
enpire_B = input().split()

enpire_Ai = [int(enpire_A[i]) for i in range(n)]
enpire_Bi = [int(enpire_B[i]) for i in range(m)]

enpire_Ai.append(X)
enpire_Bi.append(Y)


if max(enpire_Ai) < min(enpire_Bi):
    print('No War')
    exit()

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(' ')] + [X]
y = [int(i) for i in input().split(' ')] + [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(" ")) 
li_x = list(map(int,input().split(" ")))
li_y = list(map(int,input().split(" ")))

li_x.extend([x])
li_y.extend([y])

max_x = max(li_x)
min_y = min(li_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())
xcity = list(map(int,input().split()))
ycity = list(map(int,input().split()))
if max([x] + xcity) < min([y] + ycity):
    print("No ",end='')
print("War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int,input().split())
xl = list(map(int, input().split()))
xl.append(x)
xl.sort()
yl = list(map(int, input().split()))
yl.append(y)
yl.sort()

if xl[n] < yl[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()))
z = []

for i in range(X + 1, Y + 1):
    if max(x) < i and i <= min(y):
        z.append(i)

if len(z) == 0:
    print('War')
else:
    print('No War')

Submission status: Accepted

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

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

for i in range(0,N):
    if X < x[i]:
        X = x[i]

for j in range(0,M):
    if Y > y[j]:
        Y = y[j]

if Y-X > 0:
    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()))

x_max = max(X_list)
y_min = min(Y_list)

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

if war:
    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()))
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())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))
xlist.append(X)
ylist.append(Y)
xlist.sort()
ylist.sort()

if xlist[-1] < ylist[0]:
   print("No War")
else:
   print("War")

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()))
xlist.append(X)
ylist.append(Y)
xlist.sort()
ylist.sort()
xlist.reverse()

if xlist[0] < ylist[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()))

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

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 = 'No War' if max([X] + x) < min([Y] + y) else 'War'
print(ans)

Submission status: Accepted

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

zx = x[N-1] + 1
zy = y[0]
if (zx <= zy) and (Y >= zx) and (zy > X):
    print ('No War')
else:
    print ('War')

Submission status: Accepted

Solution code:
def main():
  n, m, X, Y = map(int, input().split())
  x = [X] + [int(i) for i in input().split()]
  y = [Y] + [int(i) for i in input().split()]
  print("War" if (min(y) - max(x) < 1) else "No War")
main()

Submission status: Accepted

Solution code:
# coding: utf-8
 
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)
flag = 0

if max(xn) < min(ym):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

if max(xline)<min(yline):
  print("No War")
else:
  print("War")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input().split()

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

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

X = int(a[2])
Y = int(a[3])

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

def max(x):
    max = x[0]
    for i in range(1,len(x)):
        if max < x[i]:
            max = x[i]
    return max

def min(x):
    min = x[0]
    for i in range(1,len(x)):
        if min > x[i]:
            min = x[i]
    return min

bmax = max(b)
cmin = min(c)

if bmax >= cmin:        
    print("War")

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

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

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

x.sort(reverse=True)
y.sort()

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

Submission status: Accepted

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

a = max(a)
b = min(b)
if x < b and y > a and a < b:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
N,M,X,Y = map(int, input().split())
num_list = [list(map(int, input().split())) for _ in range(2)]

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

for z in Z:
    if max(num_list[0]) < z and min(num_list[1]) >= z:
        print('No War')
        break
    if z == Z[-1]:
        print('War')

Submission status: Accepted

Solution code:
a = input().split()
for i in range(len(a)):
    a[i]=int(a[i])

x = input().split()
for i in range(len(x)):
    x[i]=int(x[i])

y = input().split()
for i in range(len(y)):
    y[i]=int(y[i])
    
X = [a[2]]
Y = [a[3]]
X_and_x = X + x
Y_and_y = Y + y

if min(Y_and_y)> max (X_and_x):
    print("No War")
else:
        print("War")

Submission status: Accepted

Solution code:
a = raw_input().strip().split()
[n,m,X,Y] = [int(i) for i in a]
x = raw_input().strip().split()
x = [int(i) for i in x] + [X]
y = raw_input().strip().split()
y = [int(i) for i in y] + [Y]
x_m = max(x)
y_m = min(y)
if (x_m < y_m):
	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()))


ans = "War"
for i in range(X + 1, Y + 1):
    if i > max(x_L) and  i <=  min(y_L):
        ans = "No War"
        break

print(ans)

Submission status: Accepted

Solution code:
import sys

def main():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    ans = "War"

    z = Y
    while z > X:
        if max(x) < z <= min(y):
            ans = "No War"
        z -= 1

    print(ans)

main()

Submission status: Accepted

Solution code:
def main():
    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 <= min(y):
            ans = "No War"
            break

    print(ans)

main()

Submission status: Accepted

Solution code:
def solv():
    count = 0
    for i in field:
        if i > 1:
            print("War")
            return
        if i == 1:
            count += 1
        if count == N+1:
            print("No War")
            return


N, M, X, Y = map(int, input().split())
x = [int(i)+100 for i in input().split()]
y = [int(i)+100 for i in input().split()]
field = [0 for _ in range(201)]
field[X+100] += 1
field[Y+100] += 2
for i in x:
    field[i] += 1
for i in y:
    field[i] += 2
solv()

Submission status: Accepted

Solution code:
import sys
n, m, x, y = map(int, input().split())
lineA = list(map(int, input().split()))
lineB = list(map(int, input().split()))
maxA = max(lineA)
minB = min(lineB)
if maxA >= minB:
    print("War")
else:
    for i in range(x + 1, y):
        if maxA < i and i <= minB:
            print("No War")
            sys.exit(0)
    print("War")

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


xmax=max(x,max(xlist))
ymin=min(y,min(ylist))

if xmax +1 <= ymin:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    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 max_x > min_y:
        print('War')
        return
    if X >= Y:
        print('War')
        return
    for i in range(X+1, Y):
        if max_x < i <= min_y:
            print('No War')
            break
    else:
        print('War')





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
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): # X < z <= Y
    if max(x) < z and min(y) >= z:
        print("No War")
        sys.exit()
print("War")

Submission status: Accepted

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

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

xx = max(x)
yy = min(y)

war = True
if xx < yy:
    z = []
    for i in range(xx+1,yy+1):
        z.append(i)
    for i in range(len(z)):
        if z[i] <= Y and z[i] > X:
            war = False
            break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=input().split()[2:];print('No '*(max(map(int,input().split()+[x]))<min(map(int,input().split()+[y])))+'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 min(y) > max(x):
    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()))

outbreak = True

for z in range(x, y+1):
    if x < z < y and max(xs) < z and min(ys) >= z:
        outbreak = False

print('War' if outbreak else 'No War')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 x < y and x < Y and X < y:
	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()))

# Judge "War" or "No War"
max_x = max(max(x_list), X)
min_y = min(min(y_list), Y)

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

Submission status: Accepted

Solution code:
iptA=list(map(int,input().split()))
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
X.append(iptA[2])
Y.append(iptA[3])
     
xmax,ymin=max(X),min(Y)
if xmax>=ymin:
    print('War')
else:
    print('No War')

Submission status: Accepted

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

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

    for n in range(X+1,Y+1):
        zs.append(n)

    xMax = max(xs)
    yMin = min(ys)
    tmp = []
    for z in zs:
        if z > xMax:
            tmp.append(z)
        if z <= yMin:
            tmp.append(z)

    flag = False
    for z in zs:
        if tmp.count(z) > 1:
            flag = True


    if len(zs) == 0:
        print("War")
        return 0

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# encoding: utf-8
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

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

ans = "War"
for z in range(X + 1, Y + 1):
    if x_max < z <= y_min:
        ans = "No War"
        break

print(ans)

Submission status: Accepted

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

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

res = False
for th in range(X+1, Y+1):
  is_up = all([x < th for x in xs ])
  is_down = all([y >= th for y in ys])
  
  #print(th, is_up, is_down)
  if is_up and is_down:
    res = True

print("No War" if res else "War")

Submission status: Accepted

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

for z in range(x+1,y+1):
  if max(a)<z and min(b)>=z:
    print("No War")
    break
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()))

x_list.sort()
y_list.sort()

for z in range(X+1, Y):
    if x_list[-1] < z <= y_list[0]:
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m,x,y = LI()
    a = LI()
    b = LI()
    t = max(a)
    u = min(b)
    for i in range(x+1,y+1):
        if t < i <= u:
            return 'No War'

    return 'War'


print(main())

Submission status: Accepted

Solution code:
from sys import stdin
il = lambda: list(map(int, input().split()))
IL = lambda: list(map(int, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n, m, x, y = IL()
xs = IL()
ys = IL()
a = max(xs)
b = min(ys)
if x < a and b <= y and a < b:
    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)

def check1():
    for Z in range(-100, 101):
        flag = True

        for v in x:
            if Z <= v:
                flag = False
                break
        
        for v in y:
            if v < Z:
                flag = False
                break
        
        if flag:
            return False
        
    return True


def check2():
    return max(x) >= min(y)

if check1():
    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()))
x.append(X)
y.append(Y)

def check2():
    return max(x) >= min(y)

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

Submission status: Accepted

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

print("No War" if max([x]+a) < min([y]+b) else "War")

Submission status: Accepted

Solution code:
N, M, X, Y = tuple(map(int, input().split()))
area_X = [int(x) for x in input().split()]
area_Y = [int(x) for x in input().split()]
area_X.append(X)
area_Y.append(Y)

print('No War' if max(area_X) < min(area_Y) else 'War')

Submission status: Accepted

Solution code:
#abc110b

N,M,X,Y=map(int,raw_input().split())
x=map(int,raw_input().split())
y=map(int,raw_input().split())
xmax=max(x)
ymin=min(y)
if xmax<Y and ymin>X and xmax<ymin:
 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.append(X)
YL.append(Y)

Xa = max(XL)
Ya = min(YL)

if Xa < Ya:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
xlst = list(map(int, input().split()))
ylst = list(map(int, input().split()))
xlst += [x]
ylst += [y]
xmax = max(xlst)
ymin = min(ylst)
if xmax < ymin:
    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()))
mx = max(xs)
my = min(ys)
for z in range(mx+1,my+1):
    if X < z <= Y:
        print('No War')
        exit()
print('War')

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
arr1.append(x)
arr2.append(y)
if(max(arr1)>=min(arr2)):
	print("War")
else:
	print("No War")

Submission status: Accepted

Solution code:
n,m,x,y = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = max(a)
b = min(b)
if (a<b and a+1>x and a+1<=y):
  print("No War")
else:
  print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n,m,x,y = (int(_) for _ in input().split())
xl = [int(_) for _ in input().split()]
yl = [int(_) for _ in input().split()]

xl.append(x)
yl.append(y)

xl.sort()
yl.sort()

print('War') if (xl[-1] >= yl[0]) 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+[X])<min(y+[Y]):
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
amax=max(a)
bmin=min(b)
c=a+b;flag=0
for i in range(n+m):
    if (c[i]>x and c[i]<=y) and (amax<c[i]) and (bmin>=c[i]):
        print('No War')
        flag=1
        break
if flag==0:
    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()))
for z in range(X+1, Y+1):
    check = True
    for p in x:
        if p >= z:
            check = False
            break
    if check:
        for q in y:
            if q < z:
                check = False
                break
        if check:
            print("No War")
            exit()
print("War")

Submission status: Accepted

Solution code:
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)
xmax = max(xs)
ymin=  min(ys)
if xmax<ymin:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

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')

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

x.sort()
y.sort()

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

Submission status: Accepted

Solution code:
#110b
n,m,x,y=map(int,input().split())
a=[int(i) for i in input().split()] + [x]
b=[int(i) for i in input().split()] + [y]

A=max(a)
B=min(b)

print('No War' if A<B else 'War')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin

s_in = lambda: stdin.readline()[:-1] # s = s_in()
d_in = lambda: int(stdin.readline()) # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split())) # List = ds_in()

N, M, X, Y = ds_in()
x_arr = ds_in()
y_arr = ds_in()

max_x = max(x_arr)
min_y = min(y_arr)
for z in range(X+1, Y+1):
    if max_x < z and z <= min_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())) + [X]
y = list(map(int, input().split())) + [Y]

#print(x)
#print(y)

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

if x_max >= y_min:
    ans = True
else:
    ans = False

if ans:
    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())) + [X]
y = list(map(int, input().split())) + [Y]

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

if x_max >= y_min:
    war_happen = True
else:
    war_happen = False

print('War' if war_happen else 'No War')