Problem:
 Score : 200 points    Problem Statement Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.  The capital of Empire A is located at coordinate X , and that of Empire B is located at coordinate Y .  One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.  If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.   X < Z \leq Y  x_1, x_2, ..., x_N < Z  y_1, y_2, ..., y_M \geq Z   Determine if war will break out.      Constraints  All values in input are integers.  1 \leq N, M \leq 100  -100 \leq X < Y \leq 100  -100 \leq x_i, y_i \leq 100  x_1, x_2, ..., x_N \neq X  x_i are all different.  y_1, y_2, ..., y_M \neq Y  y_i are all different.         Input Input is given from Standard Input in the following format:  N  M  X  Y  x_1  x_2  ...  x_N  y_1  y_2  ...  y_M       Output If war will break out, print War ; otherwise, print No War .        Sample Input 1 3 2 10 20
8 15 13
16 22      Sample Output 1 No War  The choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.   X = 10 < 16 \leq 20 = Y  8, 15, 13 < 16  16, 22 \geq 16        Sample Input 2 4 2 -48 -1
-20 -35 -91 -23
-22 66      Sample Output 2 War       Sample Input 3 5 3 6 8
-10 3 1 5 -100
100 6 14      Sample Output 3 War

Solution (Python):
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.sort()
y.sort()
for i in range(-100,101):
    if x[N-1] < i <= y[0] and X < i <= Y:
        print("No War")
        break
    if i == 100:
        print("War")

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

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

max_x = max(x)
min_y = min(y)
ans = 'War'
for z in range(X+1, Y+1):
    if z > max_x and z <= min_y:
        ans = 'No War'
        break

print(ans)

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

Solution (Python):
n,m,x,y = map(int,input().split())
xli = list(map(int,input().split()))
yli = list(map(int,input().split()))
z = max(max(xli),x)+1 
if z <= min(yli) and  z <= y:
    print("No War")
else:
    print("War")

Solution (Python):
_,_,x,y=map(int,input().split())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))
f=0
for i in range(max(xl),min(yl)):
  if x<i<y:
    f=1
if f==1:
  print("No War")
else:
  print("War")

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

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

Solution (Python):
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
z=min(b)
for i in range(n):
    if a[i]>=z:
        print("War")
        exit()
if x<z<=y:
    print("No War")
else:
    print("War")

Solution (Python):
n,m,X,Y=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
x.sort()
y.sort()
ans=0
for z in range(X+1,Y+1):
    if x[-1]<z and y[0]>=z:
        ans+=1
if ans==0:
    print("War")
else:
    print("No War")

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

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

maxx=max(max(x),X)
miny=min(min(y),Y)

print('No War'if maxx<miny else 'War')

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

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

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

for i in range(X+1,Y+1):
    if max(x) < i and min(y) >= i:
        print('No War')
        break
else:
    print('War')

Solution (Python):
a,b,c,d= input().split()
w,x,y,z=(int(a),int(b),int(c), int(d))
x_ps_str=input().split()
y_ps_str=input().split()
x_ps = []
y_ps=[]
for i in range(w):
    x_ps.append(int(x_ps_str[i]))
    
for i in range(x):
    y_ps.append(int(y_ps_str[i]))

count =0 
ans_list = []
for i in range(101):
    ans_list.append(i)
    ans_list.append(-1*i)
ans_list.sort()
for i in range(len(ans_list)):
    if y<i and i <= z:
        if max(x_ps) < i and i <= min(y_ps):
            print('No War')
            break
        else:
            count += 1
    else:
        count += 1
if count == 202:
    print('War')

Solution (Python):
n, m, x, y = map(int, input().split())
lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
lst1.sort(reverse = True)
lst2.sort()
m1 = lst1[0] + 1
m2 = lst2[0]
judge = False
for i in range(m1, m2+1):
  if x < i:
    if i <= y:
      judge = True
if judge:
  print("No War")
else:
  print("War")

Solution (Python):
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 or x >= Y or X >= y: print("War")
else: print("No War")

Solution (Python):
def Dimensional(n , m , x , y , xl , yl):

    ans = "War"

    xmax = max(xl) + 1
    ymin = min(yl)

    if xmax <= ymin and x < ymin and xmax < y:
        ans = "No War"

    return ans

def main():
    n , m , x , y = map(int , input().split())
    xl = list(map(int , input().split()))
    yl = list(map(int , input().split()))
    print(Dimensional(n , m , x , y , xl , yl))

if __name__ == '__main__':
    main()

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

Solution (Python):
N, M, x, y = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
Xm = max(X + [x])
Ym = min(Y + [y])

print('No War' if Xm < Ym else 'War')

Solution (Python):
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
xflg = True
yflg = True
for z in range(100):
  if X < z <= Y:
    for xn in x:
      if z <= xn:
        xflg = False  
    if xflg:
      for yn in y:
        if yn < z:
          yflg = False 
      if yflg:
        print('No War')
        exit()
      else:
        yflg = True
    else:
      xflg = True
print('War')

Solution (Python):

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

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

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

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

Solution (Python):
import sys
import math
N,M,X,Y=map(int,input().split())
V=list(map(int,input().split()))
W=list(map(int,input().split()))
V.sort()
W.sort()
ju=V[N-1]
ans=W[0]
if(ju<ans):
  if(X<ju and ju<ans and ans<=Y):
    print('No War')
  else:
    print('War')
else:
  print('War')

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

print("War" if ans == False else "No War")

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

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

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

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

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

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

Solution (Python):
n,m,x,y=map(int,input().split())
l_x=list(map(int,input().split()))
l_y=list(map(int,input().split()))
l_x.append(x)
l_y.append(y)
print("No War" if  min(l_y) - max(l_x)>= 1 else "War")

Solution (Python):
n, m, x, y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
if max(x_list + [x]) < min(y_list + [y]):
    print("No War")
else:
    print("War")

Solution (Python):
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
if x[-1] >= y[0]:
    print("War")
else:
    print("No War")

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  _n,_m,x,y = map(int,input().split())
  X = list(map(int,input().split()))
  Y = list(map(int,input().split()))
  X = sorted(X,reverse=True)
  Y = sorted(Y)
  
  for Ex in range(x+1,y+1):
    if X[0] < Ex <= Y[0]:
      print('No War')
      exit()
    else:
      pass
    
  print('War')
  
  
if __name__ == '__main__':
  main()

Solution (Python):
N, M, X, Y = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]
y = [int(_) for _ in input().split()]
for z in range(X+1, Y+1):
  if all([xx < z for xx in x]) and all([z <= yy for yy in y]):
    print('No War')
    break
else:
  print('War')

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


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

        print('No War')
        break
else:
    print('War')

Solution (Python):

n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
X.append(x)
Y.append(y)
X.sort()
Y.sort()

a = X[-1]+1

if a <= Y[0]:
    print("No War")
else:
    print("War")

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

Solution (Python):
n,m,x,y=map(int,input().split())
x1=sorted(list(map(int,input().split())))
y1=sorted(list(map(int,input().split())))
x_=x1[n-1]
y_=y1[0]
for i in range(x_+1,y_+1):
  if x<i<=y:
    print('No War')
    exit()
print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
min_y = min(y)
ans = 'War'
for i in range(-99, 101):
    if max_x < i and min_y >= i and X < i <= Y:
        ans = 'No War'
        break
print(ans)

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,m,x,y = LI()
X = LI()
Y = LI()
mx = max(X)
my = min(Y)
for i in range(x+1,y+1):
    if mx < i <= my:
        print('No War')
        quit()
print('War')

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

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

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

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

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

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

Solution (Python):
import sys

input = sys.stdin.readline

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

if max(max(x), X) >= min(min(y), Y):
    print('War')
else:
    print('No War')

Solution (Python):
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=""
if max(b)<min(c):
    for i in range(min(c)-max(b)):
        if a[2]<max(b)+i+1<=a[3]:
            d="No War"
            break
        else:
            d="War"
else:
    d="War"
print(d)

Solution (Python):
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.append(X)
y.append(Y)
a = sorted(x)[-1]
b = sorted(y)[0]
if a < b:
	print("No War")
else:
	print("War")

Solution (Python):
n, m, x, y = map(int, input().split())
x_n = list(map(int, input().split()))
y_m = list(map(int, input().split()))
x_n.append(x)
y_m.append(y)
if min(y_m) - max(x_n) < 1:
    print("War")
    exit()
print("No War")

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

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

Solution (Python):
n,m,x,y=map(int,input().split())
xn=list(map(int,input().split()))
yn=list(map(int,input().split()))
sxn=sorted(xn,reverse=True)
syn=sorted(yn,reverse=True)
if sxn[0]<syn[-1] and sxn[0]<y and x<syn[-1]:
    print("No War")
else :
    print("War")

Solution (Python):

import math
import itertools
import statistics


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


z_min = X+1
z_max = Y

if Y-X > 0:
    if z_min <= max(x) and z_max >= min(y) and min(y)-max(x)>0:
       print("No War")
       exit()
    print("War")

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

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

Solution (Python):
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x_max = max(x)
y_min = min(y)

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

Solution (Python):
n, m, x, y = map(int, input().split())
xxx = list(map(int, input().split()))
yyy = list(map(int, input().split()))
xxx.append(x)
yyy.append(y)
mx = max(xxx)
my = min(yyy)
print('No War' if mx < my else 'War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = max(list(map(int, input().split())))
y = min(list(map(int, input().split())))
print('No War' if x < y and X < y and x < Y else 'War')

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

max_x=max([X]+xlist)
min_y=min([Y]+ylist)

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

Solution (Python):
a, x, y = [list(map(int, input().split()))for i in range(3)]
if max(a[2], sorted(x)[-1])<min(a[3],sorted(y)[0]): print("No War")
else: print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = sorted(map(int, input().split()))
y = sorted(map(int, input().split()))
 
if x[-1] < y[0]:
  if Y <= x[-1] or y[0] <= X:
    print('War')
  else:
    print('No War')
else:
  print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x_max = max(x)
y_min = min(y)
if y_min - x_max > 0 and Y - x_max > 0 and y_min - X > 0:
    print("No War")
else:
    print("War")

Solution (Python):
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
s = "No War"
if max(x) >= min(y) or min(y) < X + 1 or Y < max(x) + 1:
    s = "War"
print(s)

Solution (Python):
n, m, x, y = map(int, input().split())
list_X = list(map(int, input().split()))
list_Y = list(map(int, input().split()))
ans = "War"
if min(min(list_Y),y) > max(max(list_X), x):
    ans = "No War"

print(ans)

Solution (Python):
N,M,X,Y = map(int,(input().split()))
x = list(map(int,(input().split())))
y = list(map(int,(input().split())))
l = max(x)
r = min(y)
if l >= r:
    print("War")
else:
    if X < r <= Y:
        print("No War")
    else:
        print("War")

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

import sys

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

Solution (Python):
n, m, x, y = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
c = 0
for i in range(-100, 101, 1):
    if x < i <= y:
        d = 0
        for j in s:
            if j >= i:
                d = 1
        for j in t:
            if j < i:
                d = 1
        if d == 0:
            c = 1
print("No War" if c == 1 else "War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for z in range(X+1, Y+1):
  if max(x) < z <= min(y):
    print("No War")
    exit()
print("War")

Solution (Python):
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.sort()
y.sort()
for Z in range(-100 ,101,1):
    if X<Z and Z<=Y and x[-1]<y[0] and x[-1]<Z and Z<=y[0]:
        print('No War')
        import sys
        sys.exit()
print('War')

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

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

ans="War"
for i in range(X+1,Y):
  if mx<i<=my:
    ans="No War"
    break
    
print(ans)

Solution (Python):
n,m,X,Y=map(int,input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))
Mx=max(x)
my=min(y)
if Mx<my and Mx<Y and X<my:
  print("No War")
else:
  print("War")

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

checker = 0


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

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

Solution (Python):

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

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

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

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

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

ans = 'War'
for z in range(X+1,Y+1):
    if xmax < z <= ymin:
        ans = 'No War'
        break

print(ans)

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

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

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

answer="War"
Z_x=max(x)+1
Z_y=min(y)

if Z_x<=Z_y:
    for z in range(Z_x,Z_y+1):
        if X<z<=Y:
            answer="No War"
            break
print(answer)

Solution (Python):
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x_max=max(x)
y_min=min(y)

if (y_min-x_max > 0) and (Y-X > 0) and (X<y_min) and (x_max<Y):
    print("No War")
else:
    print("War")

Solution (Python):
n,m,x,y = map(int,input().split())
d = "War"
l_x = sorted(list(map(int,input().split())))[::-1]
l_y = sorted(list(map(int,input().split())))
for i in range(x+1,y+1):
  if l_x[0]<i and l_y[0]>=i:
    d = "No War"
    break
print(d)

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

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

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

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

if True in [x_max < z <= y_min for z in range(X+1, Y+1)]:
    print('No War')
else:
    print('War')

Solution (Python):
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
mx = max(x)
my = min(y)
flag = False
for z in range(X+1,Y+1):
    if mx < z <= my:
        flag = True
        break
if flag:
    print('No War')
else:
    print('War')

Solution (Python):
n,m,x,y = map(int,input().split())
X = max(list(map(int,input().split())))
Y = min(list(map(int,input().split())))
X = max(X,x)
Y = min(Y,y)
print( 'War' if X >= Y else 'No War')

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

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

if (y_min-x_max > 0) and (Y-X > 0) and (X<y_min) and (x_max<Y):
    print("No War")
else:
    print("War")

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

    print('No War' if x_max < y_min else 'War')


if __name__ == '__main__':
    main()

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

max_l_x = max(l_x)
min_l_y = min(l_y)

b_x = x if max_l_x < x else max_l_x
b_y = min_l_y if min_l_y < y else y

if b_x < b_y:
    print('No War')
else:
    print('War')

Solution (Python):

qq,qqq,aa,bb=map(int,input().split())
a=sorted([int(x) for x in input().split()])
b=sorted([int(x) for x in input().split()])
if(max(aa,a[-1])<min(bb,b[0])):
    print("No ",end="")
print("War")

Solution (Python):
import sys


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

    xs.sort()
    ys.sort()
    a = xs[-1]
    b = ys[0]

    if a <= b:
        for i in range(b-a+1):
            z = a + i
            if a < z and z <= b and x < z and z <= y:
                print("No War")
                sys.exit(0)
        print("War")
    else:
        print("War")


if __name__ == "__main__":
    main()

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

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

Solution (Python):
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 z in range(x + 1, y + 1):
  if x < z <= y:
    if all([i < z for i in x_l]) and all([i >= z for i in y_l]):
      ans = 'No War'
      break

print(ans)

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

Solution (Python):

N, M, X, Y = [int(str) for str in input().strip().split()]
xs = [int(str) for str in input().strip().split()]
ys = [int(str) for str in input().strip().split()]

ans = False

for z in range(max(xs) + 1, min(ys) + 1):
    if X < z <= Y:
        ans = True

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

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

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

print("War")

Solution (Python):

n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x_max=max(x)
y_min=min(y)
flag=False
for i in range(X+1,Y+1):
    if x_max<i<=y_min:
        flag=True
        break
if flag:
    print("No War")
else:
    print("War")

Solution (Python):


N,M,X,Y = list(map(int, input().rstrip().split()))
x_list = list(map(int, input().rstrip().split())) + [X]
y_list = list(map(int, input().rstrip().split())) + [Y]


x_list.sort()
y_list.sort()

x_max = x_list[-1]
y_min = y_list[0]

print( "No War" if  (y_min - x_max) > 0 else "War")

Solution (Python):
n, m, x, y = map(int, input().split())
xx = [int(i) for i in input().split()]
yy = [int(i) for i in input().split()]

war = False
for z in range(x + 1, y + 1):
    if max(xx) < z <= min(yy):
        war = True

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

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

Solution (Python):
n,m,X,Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
y.append(Y)
x.sort()
y.sort()
if x[-1] < y[0]:
        print("No War")
else:
        print("War")

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

Solution (Python):
N,M,X,Y=map(int,input().split(' '))
x=list(map(int,input().split(' ')))
y=list(map(int,input().split(' ')))
if max(x) < min(y) and min(y)> X and max(x) <Y:
    print('No War')
else:
    print('War')

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


for z in range (-150, 150):
    f = True
    if X >= z:
        f = False
    if Y < z:
        f = False
    
    for a in A:
        if a >= z:
            f = False
    
    for b in B:
        if b < z:
            f = False
    
    if f:
        print("No War")
        break
else:
    print("War")

Solution (Python):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(x)
min_y = min(y)
flag = False
for Z in range(X + 1, Y + 1):
    if max_x < Z and min_y >= Z:
        flag = True
print('No War' if flag else 'War')

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

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

for z in range(x + 1, y + 1):
    if all(i < z for i in a) and all(i >= z for i in b):
        print('No War')
        exit()
print('War')

Solution (Python):
N,M,X,Y = map(int,input().split())
xl = list(map(int,input().split()))
yl = list(map(int,input().split()))
for i in range(X+1,Y):
  if max(xl) < i and min(yl) >= i:
    print("No War")
    exit()
print("War")

Solution (Python):
N,M,X,Y=map(int, input().split())
x=list(map(int, input().split()))
y=list(map(int, input().split()))
x.append(X)
y.append(Y)
if max(x)>=min(y):
  print('War')
else:
  print('No War')

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

xmax = max(xlst)
ymin = min(ylst)
cand = []
for i in range(xmax+1, ymin+1):
    cand.append(i)
    
warflag = True
for c in cand:
    if X < c <= Y:
        warflag = False
if warflag:
    print('War')
else:
    print('No War')

Solution (Python):
N, M, X, Y = map(int, input().split())
Xs = list(map(int, input().split())) + [X]
Ys = list(map(int, input().split())) + [Y]

if min(Ys) - max(Xs) >= 1:
    print("No War")
else:
    print("War")

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, M, X, Y = map(int, input().split())
    max_x = max(max(map(int, input().split())), X)
    min_y = min(min(map(int, input().split())), Y)

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

if __name__ == '__main__':
    main()

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

Solution (Python):
n,m,x,y=map(int,input().split())
xl=list(map(int,input().split()))
yl=list(map(int,input().split()))
cnt=0
for i in range(x+1,y+1):
    if max(xl)<i and i<=min(yl):
        cnt+=1
if cnt == 0:
    print('War')
else:
    print('No War')

Solution (Python):


n,m,x,y = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
l = []
if max(a)<= min(b):
    l = [i for i in range(max(a)+1,min(b)+1)]
    
for i in l:
    if x < i <= y:
        print("No War")
        break
        
else:
    print("War")

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


flag = True

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

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

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

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

if max(x) >= min(y):
  print("War")
  quit()
else:
  if max(x) <= X or min(y) > Y:
    print("War")
  else:
    print("No War")

Solution (Python):



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

for i in range(X+1,Y+1):
    if max(x)<i and min(y)>=i:
        print('No War')
        
        break
    elif i==Y:
        print('War')

Solution (Python):
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


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




def func(z):
    if (X < z and z <= Y):
        pass
    else:
        return False
    for i in range(N):
        if x[i] < z:
            pass
        else:
            return False
    for i in range(M):
        if y[i] >= z:
            pass
        else:
            return False
    return True


for i in range(-10000, 10000):
    if func(i) == True:
        print('No War')
        exit()
print('War')