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())
list_x = list(map(int,input().split(' ')))
list_y = list(map(int,input().split(' ')))
 
 
min_range = max(list_x)
max_range = min(list_y)
 
ans = 0
 
for i in range(X+1, Y+1):
  if(i > min_range and i <= max_range):
    ans = 1
 
if (ans == 1):
  print("No War")
elif (ans == 0):
  print("War")

Submission status: Accepted

Solution code:
head=[int(n) for n in input().split()]
list_x=[int(n) for n in input().split()]
list_x.append(head[2])
list_y=[int(n) for n in input().split()]
list_y.append(head[3])
if max(list_x) < min(list_y):
    print("No War")
else:
    print("War")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, M, X, Y = tuple(int(i) for i in input().split())
x = tuple(int(i) for i in input().split())
y = tuple(int(i) for i in input().split())

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

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

Submission status: Accepted

Solution code:
import sys

AN, BM, AX, BY = [int(x) for x in input().split()]
As = [int(x) for x in input().split()]
Bs = [int(x) for x in input().split()]

Z = BY

for loct in Bs:
    if loct < Z:
        Z = loct
        if Z <= AX:
            print('War')
            sys.exit()

for loct in As:
    if loct >= Z:
        print('War')
        sys.exit()

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()))
max_x = max(x)
min_y = min(y)
if max_x < min_y and max_x < Y and min_y > X:
	print("No War")	
else:
	print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split(" "))
list1 = list(map(int,input().split(" ")))
list2 = list(map(int,input().split(" ")))
list1.sort(reverse=True)
list2.sort()
while(True):
    if list1[0] >= Y:
        print("War")
        break
    if list2[0] <= X:
        print("War")
        break
    if list1[0] >= list2[0]:
        print("War")
        break
    else:
        print("No War")
        break

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=max(x)+1
b=min(y)

def judge(a,b):
    if(a>b):
        return print("War")
    else:
        z=range(a,b+1)
        for i in z:
            if(i>X and i<=Y):
                return print("No War")
        else:
            return print("War")
        
judge(a,b)

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]

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()))
flag=0
for i in range(N):
  if x[i]>=Y:
    flag+=1
for i in range(M):
  if y[i]<=X:
    flag+=1
if X>Y:
  flag+=1
if flag>0:
  print("War")
else:
  if min(y)>max(x):
    print("No War")
  else:
    print("War")

Submission status: Accepted

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

a = int(e[0])
b = int(e[1])
c = int(e[2])
d = int(e[3])

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

if xmax < ymax:
    if c < ymax:
        if xmax < d:
            print("No War")
        else:
            print("War")
    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()))
x.append(X)
y = list(map(int,input().split()))
y.append(Y)
if max(x) > min(y)-1:
    print('War')
else:
    print('No 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()]

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

    for i in x:
        if not(i < Z):
            return False
    for i in y:
        if not(i >= Z):
            return False
    return True

ans = False
for i in range(-200, 200):
    ans = ans | check(i)

print ('No War' if ans else '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()]

def is_war(x,y,xs,ys):
    mx = max(xs)
    my = min(ys)
    z = (mx + my) / 2
    if my <= mx or my <=x:
        return True
    if mx >=my or mx >=y:
        return True
    if x < z <=y:
        return False
    return True
    # if my <= x:
    #     return True
    # elif mx >= y:
    #     return True
    # elif my <= mx:
    #     return True
    # else:
    #     return False

if is_war(x,y,xs,ys):
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
nmxy = [int(i) for i in input().split()]
xx = [int(i) for i in input().split()]
yy = [int(i) for i in input().split()]

if(nmxy[2]>=nmxy[3]):
  print("War")
elif(max(xx)>=min(yy) or max(xx)>=nmxy[3] or nmxy[2]>=min(yy)):
  print("War")
else:
  print("No War")

Submission status: Accepted

Solution code:
# coding:utf-8

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

x_arr = []
x_list = input().split()
for xi in x_list:
    x_arr.append(int(xi))

y_arr = []
y_list = input().split()
for yi in y_list:
    y_arr.append(int(yi))

x_arr.sort()
y_arr.sort()

if(x_arr[-1]>x):
    xn = x_arr[-1]
else:
    xn = x


if(y_arr[0]<y):
    yn = y_arr[0]
else:
    yn = y

if(yn>xn):
    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()]
x.sort()
y.sort()
c=0
for i in range(X+1,Y+1):
    if x[-1] < i and i <= y[0]:
        c=2
if c == 0 :
    print("War")
else:
    print("No War")

Submission status: Accepted

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

n = int(N)
m = int(M)
x = int(X)
y = int(Y)


x_n = []
y_m = []


x_n = input().split()
y_m = input().split()

x_int = [int(x_n[i]) for i in range(n)]
y_int = [int(y_m[i]) for i in range(m)]
x_int.append(x)
y_int.append(y)

max_x = max(x_int)
min_y = min(y_int)



if(max_x < min_y):
      if(x < y):
            print("No War")
      else:
            print("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()))
l=a[0]
r=b[0]
for i in a:
    l=max(l,i)
        
    
           
for i in b:
    r=min(r,i)
if l==r:
    if r==y:
        print('No War')
    else:
        print('War')
elif l>r:
    print('War')
elif l>x and r<=y:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
ss=max(s)
tt=min(t)
for i in range(x+1,y+1):
  if ss<i<=tt:
    print("No War")
    exit()
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()))
XX.append(X)
YY.append(Y)
XX.sort()
YY.sort()
if(XX[-1]<YY[0]):
    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()))
x_max = max(xi)
x_min = min(xi)
y_max = max(xi)
y_min = min(yi)
a = 0
if x_max < y_min:
    if x < y_min and y > x_max:
        a += 1
if a >= 1:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

N, M, X, Y = map(int, raw_input().split())
x = map(int, raw_input().split()) + [X]
y = map(int, raw_input().split()) + [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)
war=0

nx=sorted(x)
ny=sorted(y)

if nx[N] >= ny[0]:
  print('War')
else:
  print('No War')

Submission status: Accepted

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

x = [i for i in map(int, input().split())]
x.sort()

y = [i for i in map(int, input().split())]
y.sort()

if X in x:
    print("War")
elif Y in y:
    print("War")
else:
    x.append(X)
    y.append(Y)
    if len(x) != len(set(x)):
        print("War")
    elif len(y) != len(set(y)):
        print("War")
    elif max(x) >= min(y):
        print("War")
    elif X >= Y:
        print("War")
    else:
        print("No War")

Submission status: Accepted

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

xarr.sort(reverse=True)
yarr.sort()

if x+1 >= y or xarr[0] >= yarr[0] or xarr[0] >= y or yarr[0] <= x:
    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()))

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

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

l = range(X+1,Y)

x.sort()
y.sort()

maxx = x[N-1]
miny = y[0]

def decs():
    for i in l:
        if maxx < i and i <= miny:
            return True
        
    return False

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

Submission status: Accepted

Solution code:
i=lambda t: list(map(int,t.split()))
l=i(input())
x=i(input())
y=i(input())
x.append(l[2])
y.append(l[3])
x.sort()
y.sort()
if l[3]-l[2]<1:
    print("War")
elif y[0]-x[l[0]]<1:
    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()))
c=max(a);d=min(b)
if c<d and c<y and d>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()))
accept = False

x_max = max(x)
y_min = min(y)
if X < Y:
    z = [i for i in range(X+1, Y+1)]
    
    for i in z:
        if x_max < i and i <= y_min:
            accept = True
            break
if accept:
    print("No War")
else:
    print("War")

Submission status: Accepted

Solution code:
n = input().split()
x = input().split()
y = input().split()

start = int(n[2]) + 1
end = int(n[3]) + 1
for i in range(start, end):
    check = 0
    for x_c in x:
        if i <= int(x_c):
            check = 1
            break
    for y_c in y:
        if i > int(y_c):
            check = 1
            break 
    if check == 0:
        print("No War")
        exit()
print("War")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

for z in range(-114, 114):
    if x < z <= y and xs[n - 1] < z <= ys[0]:
        print("No ", end = "")
        break

print("War")

Submission status: Accepted

Solution code:
# coding: utf-8

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)

x_min = min(Xs)
x_max = max(Xs)
y_min = min(Ys)
y_max = max(Ys)

if x_max < y_min or y_max < x_min:
	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(" "))


for i in range(max(xs) + 1, min(ys) + 1):
    if x < i <= y:
        print("No War")
        break
else:
    print("War")

Submission status: Accepted

Solution code:
n,m,x,y = [int(_) for _ in input().split()]
xList = sorted([int(_) for _ in input().split()])
yList = sorted([int(_) for _ in input().split()])

if xList[-1] < yList[0] and x < yList[0] <= y:
  print("No War")
else:
  print("War")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
f = lambda: map(int, input().split())
N, M, X, Y = f()
XS = sorted(f())
YS = sorted(f())

print('War' if XS[-1] >= YS[0] or max(X, XS[-1]) >= min(Y, YS[0]) else 'No War')

Submission status: Accepted

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

if max(L_X) < min(L_Y) and X < min(L_Y) and max(L_X) < 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_max = max(x)
y_min = min(y)
result = False
if y_min <= x_max:
    result = True
if x_max >= Y or y_min <= X:
    result = True
if result:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

line = input().split( )
line = [int(s) for s in line]
x = input().split( )
x = [int(a) for a in x]
y = input().split( )
y = [int(b) for b in y]
word = []
cx = max(x)
cy = min(y)
for z in range(line[2]+1, line[3] + 1):
    if z > cx and z <= cy:
        word.append(1)
    else:
        word.append(0)
if 1 in word:
    print("No War")
else:
    print("War")

Submission status: Accepted

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

for i in range(len(xList)):
  xList[i] = int(xList[i])
for j in range(len(yList)):
  yList[j] = int(yList[j])

xList.sort()
yList.sort()

if yList[0] > xList[len(xList) - 1] and yList[0] > X and Y > xList[len(xList) - 1]:
  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()))

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

if my - mx > 0:
    Z = mx
    for i in range(my - mx):
        Z += 1
        if X < Z and Z <= Y and mx < Z and Z <= my:
            print("No War")
            exit()
print("War")

Submission status: Accepted

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

n, m, x, y = map(int, input().split())
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
cnt=0

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

    for j in range(0,m):
        if yy[j]>=i:
            cnt+=1
    if cnt==n+m:
        print('No War')
        exit()
    cnt=0
print('War')

Submission status: Accepted

Solution code:
def main():
    n, m, cx, cy = [int(s) for s in input().split()]
    x = [int(s) for s in input().split()]
    y = [int(s) for s in input().split()]

    mx = max(cx, *x)
    my = min(cy, *y)

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

main()

Submission status: Accepted

Solution code:
li = [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(li[2])
y.append(li[3])

x.sort()
y.sort()
if((int(x[-1])) <int(y[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_list.sort()
y_list.sort()
if x_list[-1] < y_list[0]:
  if (y_list[0] > x) and (x_list[-1] < y):
    print("No War")
  else:
    print("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()))
mx=max(x+[X])
my=min(y+[Y])
r=my-mx
if r>=1:
    print('No War')
else:
    print('War')

Submission status: Accepted

Solution code:
a = input().split() 
n = int(a[0])
m = int(a[1])
x = int(a[2])
y = int(a[3])
a = input().split()
a = [int(s) for s in a]
x_max = max(a)
a = input().split()
a = [int(s) for s in a]
y_min = min(a)
if x_max >= y or y_min <= x or x_max >= y_min:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:

NMXY =  list(int(i) for i in input().split())
x =  list(int(i) for i in input().split())
y =  list(int(i) for i in input().split())

x.append(NMXY[2])

y.append(NMXY[3])

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()))
max_x = max(x)
min_y = min(y)
if max_x >= min_y or max_x >= Y or min_y <= X:
	print("War")
else:
	print("No War")

Submission status: Accepted

Solution code:
def main():
    s = [int(item) for item in input().split()]
    _, _, X, Y = s
    xs = [int(item) for item in input().split()]
    ys = [int(item) for item in input().split()]
    mx = max(xs)
    my = min(ys)
    can = False
    for i in range(mx+1, my+1):
        if X < i <= Y:
            can = True
            break
    if can:
        print('No War')
    else:
        print('War')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a=input()
b=input()
c=input()

a=[int(x) for x in a.split(" ")]
b=[int(x) for x in b.split(" ")]
c=[int(x) for x in c.split(" ")]

b.sort(reverse=True)
c.sort()

for x in range(a[2]+1,a[3]+1):
    if b[0] < x and c[0] >= x:
        print("No War")
        break
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.sort()
ys.sort()
res = 'War'
for z in range(x+1,y+1):
    if xs[n-1] < z and ys[0] >= z:
        res = 'No War'
print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created: 日  9/23 21:17:33 2018

# Usage
#
"""
def get_input():
    first = [int(i) for i in input().split(" ")]
    second = list(sorted([int(i) for i in input().split(" ")]))
    third = list(sorted([int(i) for i in input().split(" ")]))

    return first[2], first[3], second, third

def judge(x, y, x_list, y_list):
    """
    >>> judge(10,20,[8,15], [16,22])
    >>> judge(-48, -1, [-20,-35,-91,-23], [-22, 66])
    >>> judge(6,8, [-10,3,1,5,-100], [100,6,14])
    """
    x_max = max(x_list)
    y_min = min(y_list)

    if x_max >= y_min:
        return False
    if y <= x_max:
        return False
    if y_min <= x:
        return False
    return True

if __name__ == '__main__':
    # import doctest
    # doctest.testmod()
    res = judge(*get_input())
    if res:
        print("No War")
    else:
        print("War")

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8:


def main():
    N, M, X, Y = map(int, raw_input().split())
    x = [int(ele) for ele in raw_input().split()]  # N
    y = [int(ele) for ele in raw_input().split()]  # M

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = input().split() 
n = int(a[0])
m = int(a[1])
x = int(a[2])
y = int(a[3])
a = input().split()
a = [int(s) for s in a]
x_max = max(a)
a = input().split()
a = [int(s) for s in a]
y_min = min(a)
if x_max >= y:
    print("War")
elif y_min <= x:
    print("War")
else:
    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_l=list(map(int,input().split()))
y_l=list(map(int,input().split()))
for i in range(X+1,Y+1):
    if max(x_l)<i and i<=min(y_l):
        print("No War")
        exit()
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()))
l=a[0]
r=b[0]
for i in a:
    if i > x:
        if i<l:
            pass
        else:
            l=i
            if l>r:
                print('War')
                exit()
    if i>=y:
        print('War')
        exit()
           
for i in b:
    if i <y:
        if i>r:
            pass
        else:
            r=i
            if l>r:
                print('War')
                exit()
    if i<=x:
        print('War')
        exit() 
if l==r:
    if r==y:
        print('No War')
    else:
        print('War')
else:
    print('No War')

Submission status: Accepted

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

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

max_x, min_y = xs[-1], ys[0]

if x > max_x:
    max_x = x
if y < min_y:
    min_y = 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())
xs = sorted(list(map(int, input().split())))
ys = sorted(list(map(int, input().split())))

if x < ys[0] and xs[n - 1] < y and xs[n - 1] < ys[0]:
    print("No ", end = "")

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

def is_war(x,y,xs,ys):
    mx = max(xs)
    my = min(ys)
    if my <= x:
        return True
    elif mx >= y:
        return True
    elif my <= mx:
        return True
    else:
        return False

if is_war(x,y,xs,ys):
    print("War")
else:
    print("No War")

Submission status: Accepted

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

x_list.append(X)
y_list.append(Y)
if (max(x_list) < min(y_list)):
    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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
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 i in range(int(x_list[-1]) + 1, int(y_list[0]) + 1):
    if (i > x) 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()))
k=str()
if X>=Y:
  k='War'
else:  
  for i in range(X+1,Y+1):
    if max(x)<i<=min(y):
      k='No War'
      break
    elif max(x)>=i or min(y)<i:
      k='War'
      continue
      
print(k)

Submission status: Accepted

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

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

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

war = 1

if x_max >= y_min:
    pass
else:
    for i in range(x_max+1, y_min+1):
        if i in z_list:
            war = 0
            break

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

Submission status: Accepted

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

max_x = sorted(xs)[-1]
min_y = sorted(ys)[0]

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

Submission status: Accepted

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

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

xl = []
xl.append(x)
yl = []
yl.append(y)

for i in lstx:
    xl.append(int(i))

for i in lsty:
    yl.append(int(i))

if max(xl) < min(yl):
    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()))
print('No War' if any(x < i <= y for i in \
	range(max(a) + 1, min(b) + 1)) else '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()))

for z in range(-101, 101):
    if X < z <= Y and max(xN) < z and min(yM) >= z:
        print('No War')
        exit()
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())

ans = "War"

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

if X+1 > max_x+1:
    min_z = X+1
else:
    min_z = max_x+1

if Y < min_y:
    max_z = Y
else:
    max_z = min_y

if min_z <= max_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()))

flag = 0

x.sort()
y.sort()

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


if flag:
    print("War")
else:
    print("No 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()]
mx=max(x)
y=[int(j) for j in input().split()]
my=min(y)
if X>=Y:
    print("War")
else:
    for z in range(X+1,Y+1):
        if mx<z and my>=z: 
            print("No War")
            break    
        elif z==Y:
            print("War")
            break
        else:
            continue

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()] 
x.sort()
y.sort()
z = X + 1
max_x = x[-1]
min_y = y[0]
while z<Y:
    if(max_x < z and min_y >=z):
        print('No War')
        #print(z)
        break
    else:
        z = z + 1
if (z>=Y):
    print('War')

Submission status: Accepted

Solution code:
N, M, X, Y = tuple(int(i) for i in input().split())
x = tuple(int(i) for i in input().split())
y = tuple(int(i) for i in input().split())

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

if x_max >= y_min:
    print("War")
elif y_min <= X or x_max >= 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()))
x.sort()
y.sort()
Z=x[-1]+1
if Z<=y[0] and X<Z<=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()))
for i in range(X + 1, Y + 2, 1):
    if max(x) < i and min(y) >= i:
        break;
if i == Y + 1:
    print("War")
else:
    print("No War")

Submission status: Accepted

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

x_n = []
for part in input().split():
    x_n.append(int(part))
x_n.append(x)

y_n = []
for part in input().split():
    y_n.append(int(part))
y_n.append(y)

x_n.sort()
x_n.reverse()
y_n.sort()

if x_n[0] < y_n[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(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=list(map(int,input().split(' ')))
y_list=list(map(int,input().split(' ')))
x_list.append(X)
y_list.append(Y)
x_max=max(x_list)
y_min=min(y_list)

if(X < Y and x_max < y_min):
    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())
xs = sorted(xs)
ys = sorted(ys)
z = (xs[-1] + ys[0])/2

if x < z <= y and xs[-1] < z and ys[0] >= 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()))

tmp = max(xs)
z = max(tmp,x)+1

if z <= y and z <= min(ys):
  print('No War')
else:
  print('War')

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,raw_input().split())
xN=map(int, raw_input().split())
yM=map(int, raw_input().split())
    
flag=0

maxx=1+max(xN)
miny=min(yM)

if X>=maxx:
	flag=1

if Y<miny:
	flag=1

if maxx>miny:
	flag=1

if flag==0:
	print 'No War'
else:
	print 'War'