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())
xlis = list(map(int,input().split()))
ylis = list(map(int,input().split()))

if max(xlis) < min(ylis) and x < min(ylis) and max(xlis) < y:
    print('No War')
    exit()
print('War')

Submission status: Accepted

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

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

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

f=-1

ma = max(xa)
mi = min(ya)

for i in range(X+1,Y+1):
    if ma<i and i<=mi:
        f=1
        
if f>0:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
import sys
n,m,x,y = map(int,input().split())
xs = list(map(int,input().split()))
ys = list(map(int,input().split()))

i = x+1
while(i<=y):
    f = True
    for j in xs:
        if j >= i:
            f = False
    for j in ys:
        if j < i:
            f = False
    if f:
        print("No War")
        sys.exit()
    i += 1

print("War")

Submission status: Accepted

Solution code:
n,m,a,b=map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))
j=False
for i in range(a+1,b+1):
    if max(x)<i and min(y)>=i:
        j=True

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

Submission status: Accepted

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

x_in.append(x)
y_in.append(y)

x_in.sort()
y_in.sort()

x_max = x_in[-1]
y_min = y_in[0]

if x_max < y_min:
    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=sorted(xlist)
ylist=sorted(ylist)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np


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

# 空白区切りの数列をリストに代入
xx = [int(i) for i in input().split()]
yy = [int(i) for i in input().split()]

for i in range(n):
    x = max(x,xx[i])
for i in range(m):
    y = min(y,yy[i])
if x < y:
    print('No War')
else:
    print('War')

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

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

if(x_max >= y_min):
    print("War")
    sys.exit()
elif(X >= Y):
    print("War")
    sys.exit()

for i in range(x_max + 1, y_min + 1):
    if(i > X and i <= Y):
        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()))
a = max(x)
b = min(y)
flag = 0
for i in range(X+1,Y+1):
    if a < i <= b:
        flag = 1
        break
print("No War" if flag == 1 else "War")

Submission status: Accepted

Solution code:
n, m, x, y = map(int, input().split())
listX = list(map(int, input().split()))
listY = list(map(int, input().split()))
maxX = max(listX)
minY = min(listY)

flag =0
if maxX < minY:
    for number in range(x+1, y+1):
        if maxX < number and minY > number-1:
            print("No War")
            flag=1
            break
    if flag ==0:
        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()))

if max(Xl) < min(Yl) and max(Xl) < Y and min(Yl) > X:
    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')

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
 

b = list(map(int,input().split()))
c = list(map(int,input().split()))

b.append(a[2])
c.append(a[3])

b.sort()
c.sort()
if b[-1] < c[0]:
	print("No War")
else:
	print("War")

Submission status: Accepted

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

if max(xx)<min(yy) and max(xx)<y and min(yy)>x:
    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(map(int, input().split()))
y = sorted(map(int, input().split()))
x = x[-1]
y = y[0]

ok = False

for Z in range(-1000, 1001):
    if X < Z <= Y and x < Z <= y:
        ok = True

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

Submission status: Accepted

Solution code:
_, _, X, Y = map(int, input().split(' '))

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

if max(x) < min(y) and X < min(y) and Y > max(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()))
k = 0
aa = max(a)
bb = min(b)

for i in range(x+1,y+1):
    if i > aa and i <= bb:
        k = 1
if k == 0:
    print('War')
else:
    print('No War')

Submission status: Accepted

Solution code:
n,m,x,y = map(int, input().split())
xi = list(map(int, input().split()))
yi = list(map(int, input().split()))
xi.append(x)
yi.append(y)
if max(xi)<min(yi):
    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()))+[x]
b=list(map(int, input().split()))+[y]
maxa=max(a)
minb=min(b)
if maxa<minb:print('No War')
else:print('War')

Submission status: Accepted

Solution code:
import numpy as np
import math

# K = int(input())
# N, K = map(int, input().split())
# A = list(map(int, input().split()))

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

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

maxx = max(x)
miny = min(y)

maxxx = max(maxx, X)
minyy = min(miny, Y)

if maxxx < minyy:
    print('No War')
else:
    print('War')

Submission status: Accepted

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

is_war = True

for z in range(X+1, Y+1):
    if x_max < z and z <= y_min:
        is_war = False
if is_war:
    print("War")
else:
    print("No 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) :
   print('No War')
else :
   print('War')

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))

N, M, X, Y = inpl()
maxX = max(inpl())
minY = min(inpl())

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

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
x = list(input().split())
y = list(input().split())
x = [int(i) for i in x]
y = [int(i) for i in y]
res = 0
for Z in range(X+1,Y+1):
    res1 = 0
    res2 = 0
    for k in x:
        if k >= Z:
            res1 += 1
            break
    for l in y:
        if l < Z:
            res2 +=1
            break
    if res1 ==0 and res2 ==0:
        res =1
if res==0:
    print("War")
else:
    print("No 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)

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

if xx < yy:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:

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

if max(max(x), X) < min(min(y), 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()))

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

if A_right < B_left:
    ans = "No War"
else:
    ans = "War"
print(ans)

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(map(int, input().split()))
y = list(map(int, input().split()))

for z in range(X+1, Y+1):
    flg_x, flg_y = False, False

    for xi in x:
        if xi >= z:
            break
    else:
        flg_x = True

    for yi in y:
        if yi < z:
            break
    else:
        flg_y = True

    if flg_x & flg_y:
        print("No War")
        exit()

print("War")

Submission status: Accepted

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

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

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

maxb = max(b)
minc = min(c)

if maxb < minc and a[2] < a[3] and maxb < a[3] and minc > a[2]:
	print ('No War')
else:
	print ('War')

Submission status: Accepted

Solution code:
a = input().split()
for i in range(4):
    a[i] = int(a[i])
    
x = input().split()
for i in range(a[0]):
    x[i] = int(x[i])
    x.append(a[2])
    
y = input().split()
for i in range(a[1]):
    y[i] = int(y[i])
    y.append(a[3])
    
if max(x) < min(y):
    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 < max(x) + 1 <= 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()))

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

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()))
for z in range(x+1, y+1):
    war = False
    for _x in X:
        if _x >= z:
            war = True
    for _y in Y:
        if _y < z:
            war = True
    if not war:
        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()))

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

Submission status: Accepted

Solution code:
# coding: utf-8
n,m,x,y=map(int,input().split())
a=max(map(int,input().split()))
b=min(map(int,input().split()))
a=max(a,x)
b=min(b,y)
if a<b:
    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()]

mxx = max(Xx)
mny = min(Yy)
if mxx < mny and X < mny and mxx < Y:
    print("No War")
else:
    print("War")

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

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

Submission status: Accepted

Solution code:
from sys import stdin

N, M, X, Y = [int(i) for i in stdin.readline().rstrip().split()]
x = [int(i) for i in stdin.readline().rstrip().split()]
y = [int(i) for i in stdin.readline().rstrip().split()]
x.append(X)
y.append(Y)

x.sort()
y.sort()

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
listx = list(map(int, input().split()))
listy = list(map(int, input().split()))
listx.append(X)
listy.append(Y)
if max(listx) < min(listy):
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
from sys import stdin
n,m,x,y = map(int,stdin.readline().split())
ans = 'War'
a = map(int,stdin.readline().split())
b  = map(int,stdin.readline().split())
a.sort()
b.sort()
found = 0
for i in xrange(x+1,y+1):
 if max(a) < i and min(b) >= i:
  ans = 'No War'
print ans

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect

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

ch = 0
for z in range(X+1,Y+1):
    if max(Xs)<z and min(Ys)>=z:
        ch = 1
if ch == 0:
    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())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))
ans='War'
if x<y:
    for i in range(x+1,y+1):
        if max(xl)<i and min(yl)>=i:
            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 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())

xi = list(map(int, input().split()))
yi = list(map(int, input().split()))

if min(min(yi), y) > max(max(xi), 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()))

xs.append(X)
ys.append(Y)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,M,X,Y=list(map(int,input().split()))
x_max=max(list(map(int,input().split()))+[X])
y_min=min(list(map(int,input().split()))+[Y])

if x_max<y_min:
    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()))

a = max(x)+1

b = min(y)

c = [i for i in range(a,b+1)]

d = [i+1 for i in range(X,Y)]

ans = 'War'

for i in d:
	if i in c:
		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()))

Ans = "War"
maxX = max(x)
minY = min(y)
for i in range(maxX+1,minY+1):
    if X < i <= Y:
        Ans = "No War"

print(Ans)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m,x,y = li()
xs = list(li()) + [x]
ys = list(li()) + [y]

xmax = max(xs)
ymin = min(ys)

if xmax < ymin:
    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()
y.sort()


if y[0]>x[N-1] and y[0]>X and x[N-1]<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()]
ans = 'War'
for z in range(X+1, Y+1):
    if all([i < z for i in x]) and all([i >= z for i in y]):
        ans = 'No War'
        break
print(ans)

Submission status: Accepted

Solution code:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n,m,x,y = getlist()
xs = getlist()
ys = getlist()

maxx = max(xs)
miny = min(ys)

ans = "No War"
#print(maxx,miny)
if maxx >= miny:

    ans = "War"

if maxx>= y:
    ans = "War"

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

Submission status: Accepted

Solution code:
def nl(): return list(map(int, input().split()))
# print('Yes' if a else 'No')

N, M, X, Y = nl()
x = nl()
y = nl()

flg = False
for i in range(X + 1, Y + 1):
    if max(x) < i and i <= min(y):
        flg = True
        break

print('No War' if flg else '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('No War' if max(x)<min(y) else 'War')

Submission status: Accepted

Solution code:
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]

[n,m,X,Y]=i2()
x=i2()
y=i2()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_,_,x,y = [int(i) for i in input().split()]

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

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

Submission status: Accepted

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

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

print('War')

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
X_max = max(list(map(int,input().split()))+[X])
Y_min = min(list(map(int,input().split()))+[Y])

if X_max < Y_min:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
# your code goes here
N,M,X_c,Y_c = map(int,input().split())

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

X.sort()
Y.sort()

if max(X[-1],X_c) < min(Y[0],Y_c):
	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())) + [X]
ys = list(map(int, input().split())) + [Y]
if max(xs) < min(ys):
  print('No War')
else:
  print('War')

Submission status: Accepted

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


xs.append(X)
ys.append(Y)

xs.sort()
ys.sort()

#print(xs, ys)

result = False

if xs[-1] >= ys[0]:
    result = True

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

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

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

if mx<my :
    print("No War")
else:
    print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
il = lambda: list(map(int, input().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, x1, y1 = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(x1)
y = list(map(int, input().split()))
y.append(y1)

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

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, raw_input().split())
A = map(int, raw_input().split())
B = map(int, raw_input().split())
a = max(A)
b = min(B)

for i in xrange(-110, 110):
    if a < i <= b and X < i <= Y:
        print "No War"
        exit()
print "War"

Submission status: Accepted

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

if max(max(x), X) < min(min(y), 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()))

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

Submission status: Accepted

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

def check(Z):
    if not X < Z <= Y:
        return 0

    for e in x:
        if not e < Z:
            return 0

    for e in y:
        if not Z <= e:
            return 0
    return 1

for Z in range(-100, 101):
    if check(Z):
        print('No War')
        break
else:
    print('War')

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N, M, X, Y = li_input()
    x_list = li_input()
    y_list = li_input()

    for Z in range(X + 1, Y + 1):
        x_fill = 0
        y_fill = 0

        for x in x_list:
            if x < Z:
                x_fill += 1
        
        for y in y_list:
            if y >= Z:
                y_fill += 1
        
        if x_fill == len(x_list) and y_fill == len(y_list):
            print("No War")
            return
    
    print("War")


main()

Submission status: Accepted

Solution code:
n,m,x,y = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if max(a)<min(b) and x<max(a)+1<=y: print("No War")
else: print("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:
import numpy as np


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)

if np.max(x) < np.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 = sorted(X)
Y = sorted(Y)
for i in range(x+1,y+1):
    if X[-1]<i and Y[0]>=i:
        print('No War')
        exit()
print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,raw_input().split())
xs = map(int,raw_input().split())+[x]
ys = map(int,raw_input().split())+[y]
print "No War" if max(xs)<min(ys)  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()))
Xs.append(X)
Ys.append(Y)
if max(Xs) < min(Ys):
    print('No War')
else:
    print('War')

Submission status: Runtime Error

Solution code:
n,m,x,y = map(list(input().split()))
a = map(list(input().split()))
b = map(list(input().split()))
max_x = max(a)
max_y = max(b)
max_x = max(max_x,x)
max_y = max(max_y,y)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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


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

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

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
	n,m,x,y = map(int,input().split())
	X = list(map(int,input().split()))
	Y = list(map(int,input().split()))
 
	x_max = max(X)
	y_min = min(Y)
 
 	flg = False
	for Z in range(x+1,y+1):
		if x_max < Z and Z <= y_min:
			flg = True
			break

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

Submission status: Runtime Error

Solution code:

if __name__ == '__main__':
	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)

	for Z in range(x,y):
		if y_max < Z <= y_min:
			print("No war")
			break
	else:
		print("War")