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

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

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

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

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

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

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


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

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

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

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

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

Solution (Python):


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

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

Solution (Python):


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

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

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

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

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()
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')
        
        break
    else:
        z = z + 1
if (z>=Y):
    print('War')

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

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

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

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

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_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")

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

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

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

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

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

    mergin = list(range(X, Y))
    flag = False
    if not mergin:
        mergin.append(0)
        flag = True
    x_line = min(mergin)
    y_line = max(mergin)

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

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

if __name__ == "__main__":
    main()

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

for z in range(X+1,Y+1):
    if x[-1]<z<=y[0]:
        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("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()))
a.append(x)
b.append(y)

a.sort()
b.sort()

if a[n]<b[0]:
  flag="No War"
else:
  flag="War"

print(flag)

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






for z in range(-100, 101):
    if X < z and z <= Y and max(x) < z and z <= min(y):
        print("No War")
        exit(0)
print("War")

Solution (Python):
def main():
    N, M, X, Y = (int(i) for i in input().split())
    x = sorted([int(i) for i in input().split()])
    y = sorted([int(i) for i in input().split()])
    if (x[-1] > y[0]):
        return 'War'
    else:
        for i in range(x[-1] + 1, y[0] + 1, 1):
            if i > X and i <= Y:
                return 'No War'
        return 'War'


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

Solution (Python):
ai = lambda: list(map(int, input().split()))
ai_ = lambda: [int(x) - 1 for x in input().split()]

n, m, X, Y = ai()
x = ai()
y = ai()
if max(x) < min(y) and X < max(x)+1 <= 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()))
if min(y)>max(x):
    sec=list(range(max(x)+1,min(y)+1))
    for i in range(X+1,Y+1):
        if i in sec:
            print('No War')
            break
    else:
        print('War')
else:
    print('War')

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

z = min(min(xlis),min(ylis),x,y)
while (z <= max(max(xlis),max(ylis),x,y)):
    if x < z <= y and max(xlis) < z and z <= min(ylis):
        print('No War')
        exit()
    z +=1

print('War')

Solution (Python):
n, m, x, y = map(int, input().split())
l_x = [int(_) for _ in input().split()]
l_y = [int(_) for _ in input().split()]
max_x = max(l_x)
min_y = min(l_y)
if max_x < min_y:
    l_ans = set([i for i in range(max_x+1, min_y+1)])
    l_ans2 = set([i for i in range(x+1, y+1)])
    if l_ans & l_ans2:
        print("No War")
    else:
        print("War")
else:
    print("War")

Solution (Python):
A=list(map(int,input().split()))
X=list(map(int,input().split()))
Y=list(map(int,input().split()))

x=max(X)
y=min(Y)

if x<y and A[2]<A[3] and A[2]<y and x<A[3]:
    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()))
ans = 1

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

Solution (Python):
N, M, X, Y = map(int, input().split(' '))
max_x = max(map(int, input().split(' ')))
min_y = min(map(int, input().split(' ')))

if max_x < min_y:
    cand = [max_x+i+1 for i in range(min_y - max_x)]
    is_war = True
    for i in cand:
        if X < i <= Y:
            print('No War')
            is_war = False
            break
    if is_war:
        print('War')
else:
    print('War')

Solution (Python):
n, m, x, y = [int(i) for i in input().split()]
x1 = max([int(i) for i in input().split()])
y1 = min([int(i) for i in input().split()])

for i in range(x+1,y):
    if x1 < i and i <= y1:
        print("No War")
        break
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()))
max_A = max(A)
min_B = min(B)

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

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


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


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


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


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


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


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


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


def mt(f):
    import time

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

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

    return wrap


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

    error_print(mx, my)
    if mx >= my:
        return 'War'

    for i in range(mx+1, my+1):
        if X < i <= Y:
            return 'No War'
    return 'War'


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


if __name__ == '__main__':
    main()

Solution (Python):
n,m,x,y=map(int,input().split())
xi=list(map(int,input().split()))
yi=list(map(int,input().split()))
xi.sort()
yi.sort()
z=yi[0]
war=1
if(xi[n-1]>=yi[0]):
    print('War')
else:
    for z in range(xi[n-1]+1,yi[0]+1):
        if(z>x and z<=y):
            war=0
            break
    if(war):
        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()))

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

Solution (Python):





n,m,x,y = map(int, input().split())
xlist = [int(i) for i in input().split()]
ylist = [int(i) for i in input().split()]



xlist.append(x)
ylist.append(y)

maxnum=max(xlist)
minnum=min(ylist)

    

    

if maxnum<minnum:
    print("No War")
else:
    print("War")

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

xl = [int(x) for x in input().split()]
yl = [int(x) for x in input().split()]

xl.sort()
yl.sort()

xmax = xl[-1]
ymin = yl[0]

war = 'War'
nowar = 'No War'

kyokai = xmax + 1

isOk = False

if xmax < ymin:
    isOk = True
else:
    print(war)
    exit()

if kyokai <= ymin:
    pass
else:
    print(war)
    exit()

if X < kyokai:
    pass
else:
    print(war)
    exit()

if kyokai <= Y:
    pass
else:
    print(war)
    exit()


print(nowar)

Solution (Python):
def inpl(): return list(map(int, input().split()))
n,m,x,y = inpl()
xs = inpl()
ys = inpl()

for z in range(-100,101):
    if max(xs)<z and z<=min(ys) and x<z and z<=y:
        print('No War')
        break
else:
    print('War')

Solution (Python):


def main():
    N, M, X, Y = tuple(int(x) for x in input().split(" "))
    Xs = list(int(x) for x in input().split(" "))
    Ys = list(int(x) for x in input().split(" "))
    Xs.sort()
    Ys.sort()
    if Xs[-1] < Ys[0]:
        for n in range(Xs[-1]+1, Ys[0]+1):
            if X < n <= Y:
                print("No War")
                return
    print("War")




if __name__ == "__main__":
    main()

Solution (Python):
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) or min(ylis) <= x or max(xlis) >= y:
    print("War")
else:
    print("No War")

Solution (Python):
n,m,xPos,yPos = list(map(int,input().split()))
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.sort(reverse=True)
y.sort()

if x[0] >= y[0] or y[0] <= xPos or x[0] >= yPos :
    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()))
x.sort()
y.sort()
if x[-1]<y[0] and y[0]>X and x[-1]<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()))
A.append(X)
B.append(Y)

maxA = max(A)
minB = min(B)

if minB > maxA :
    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()))
xl.sort()
yl.sort()
z = []
for i in range(x+1,y+1):
    z.append(i)
i = 0
while len(z) > i:
    if z[i] <= xl[n-1] or z[i] <= x:
        z.pop(i)
        continue
    if yl[0] < z[i] or y < z[i]:
        z.pop(i)
        continue
    i += 1
    if len(z) == 0:
        break
if len(z) > 0:
    print("No War")
else:
    print("War")

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

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

count_x = sum(t < min_y for t in x)

re = 'War'
if count_x == N : 
    if  X < min_y and min_y <= Y:
        re = 'No War'
    elif X < max_x + 1 and max_x + 1 <= Y:
        re = 'No War'
    
print(re)

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

flag = True


z_list = None
if x < y:
  z_list = range(x+1, y+1)
else:
  flag = False


x_cities.sort()
y_cities.sort()

for z in z_list:
  if x_cities[-1] < z <= y_cities[0]:
    break
else:
  flag = False
  
if flag == True:
  print('No War')
else:
  print('War')

Solution (Python):



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

    x_max = max(xs) + 1
    y_min = min(ys)

    if x_max > y_min:
        print('War')
        exit()

    if x_max == y_min:
        if x < x_max <= y:
            print('No War')
            exit()

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

    print('War')


if __name__ == '__main__':
    main()

Solution (Python):

N, M, X, Y = (int(i) for i in input().split())

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

mx = max(xx)
my = min(yy)

flag = 1

for i in range(201):
   Z = i - 100
   if (X < Z) and (Z <= Y) and (mx < Z) and (Z <= my):
       flag = 0

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

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

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

ans = 'War'
for i in range(X + 1, Y + 1):
    if max(xs) < i and min(ys) >= i:
        ans = 'No War'

print(ans)

Solution (Python):
l=list(map(int,input().split()))
n=l[0]
m=l[1]
x=l[2]
y=l[3]

l1=max(list(map(int,input().split())))
l2=min(list(map(int,input().split())))
q=0
if l1<l2:
    if l1<y:
        if x<l2:
            print("No War")
            q=1
if q==0:
    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()))
j = 0
for i in range(x+1,y+1):
    if i > max(x_l) and i <= min(y_l):
        j+= 1
print("No War" if j else "War")

Solution (Python):
n,m,cx,cy = map(int,input().split())
x = list(int(i) for i in input().split())
y = list(int(i) for i in input().split())

x.sort()
y.sort()
z = range(cx+1,cy+1)

ans = "War"
for v in z:
    if (v > x[n-1]) and (v <= y[0]):
        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()))
tempx = max(x)
tempy = min(y)
judge = False
for i in range(X+1,Y+1):
    if tempx < i <= tempy:
        judge = True
if judge:
    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 X >= Y:
  print('War')
elif max(x) >= Y:
  print('War')
elif X >= min(y):
  print('War')
elif max(x) >= min(y):
  print('War')
else:
  print('No War')

Solution (Python):


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

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

x.sort()
y.sort()

war_flag = 0

if X >= Y:
    war_flag = 1

if x[-1] >= y[0]:
    war_flag = 1

if y[0] <= X:
    war_flag = 1

if x[-1] >= Y:
    war_flag = 1


if war_flag == 1:
    print("War")
else:
    print("No War")

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

X_Y=list(range(X+1,Y+1))
X_max=max(map(int, input().split()))
Y_min=min(map(int, input().split()))
count=0
for i in X_Y:
  if X_max<i and Y_min>=i:
    print('No War')
    count+=1
    break

if count!=1:
  print('War')

Solution (Python):
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
xmax=-101
ymin=101
for i in range(N):
	if x[i]>xmax:
		xmax=x[i]
for i in range(M):
	if y[i]<ymin:
		ymin=y[i]
if ymin>xmax:
	if X<ymin and ymin<=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()))
x.append(X)
y.append(Y)
if max(x)<min(y):
	print("No War")
else:
	print("War")

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

x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
print("No War" if (max(x)<min(y) and a<b and a<min(y) and b>max(x)) 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()
x.reverse()
y.sort()


answer = 'War'

if X>=Y:
	answer = 'War'
if X<Y:	
	for i in range(X+1,Y+1):
		if x[0] < i <= y[0]:
			answer = 'No War'
	
print(answer)

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

maxx = max(x)
miny = min(y)
if X <= maxx < miny <= 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()))
flag = 0
a = max(A)
b = min(B)
for i in range(X+1,Y) :
    if i > max(A) and i <= Y and i <= min(B) and i > X :
        flag += 1
if flag >= 1 :
    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()]
flag = False

if min(y) > max(x):

    for i in range(max(x)+1,min(y)+1):

        if Y >= i > X:
            flag = True

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

Solution (Python):
n,m,x,y=map(int,input().split())
lis_x = list(map(int,input().split()))
lis_y = list(map(int,input().split()))
lis_x.sort()
lis_y.sort()
rest = []
for i in range(100):
    if i > lis_x[-1] and i <= lis_y[0]:
        rest.append(i)
for i in range(len(rest)):
    if x < rest[i] and rest[i] <= y:
        print('No War')
        exit()
print('War')

Solution (Python):

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

nowar = False
for Z in range(X+1,Y+1):
    if max(xn) < Z and Z <= min(ym):
        nowar = True

if nowar:
    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()))
ans = 1

if X >= Y:
    ans = 1
elif X < Y:
    z = list(range(X+1, Y+1))

for i in z:
    if max(x) < i and i <= min(y):
        ans = 0
        
if ans == 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()))
assert len(x) == N and len(y) == M

mx = max(x)
my = min(y)
nowar = mx < my and mx < Y and X < my

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

Solution (Python):
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:print('War')
else:
  if c>=y or d<=x:print('War')
  else:print('No War')

Solution (Python):
input_list = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a_list.sort()
b_list.sort()

a_max = a_list[-1]
b_min = b_list[0]

for n in range(input_list[2]+1, input_list[3]+1):
    if a_max < n <= b_min:
        print("No War")
        exit()
print("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_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")

Solution (Python):
n, m, xc, yc = [int(_) for _ in input().split(' ')]
x = [int(_) for _ in input().split(' ')]
y = [int(_) for _ in input().split(' ')]
x.append(xc)
y.append(yc)

if xc >= yc or max(x) >= min(y):
    print('War')
else:
    print('No War')

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N,M,X,Y = inpl()
X = max(max(inpl()),X)
Y = min(min(inpl()),Y)
if X < Y:
    print("No War")
else:
    print("War")

Solution (Python):
n, m, x, y = map(int, input().split())
x_list = [int(data) for data in input().split()]
y_list = [int(data) for data in input().split()]

if x < y and max(x_list) < min(y_list) and max(x_list) > x and min(y_list) < 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()]
if X < Y and max(x) < min(y) and  min(y) > X and max(x) < Y:
    print('No War')
else:
    print('War')

Solution (Python):
N, M, X, Y = map(int, input().split())
x = [int(a) for a in input().split()]
y = [int(a) for a 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):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))



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


def is_war(x, y):
    flag = "No War"
    for i in x:
        for j in y:
            if i >= j:
                flag = "War"
                return flag
    return flag


flag = is_war(x, y)
print(flag)

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

if min(y) > max(x):
    
    if (Y >= max(x) + 1) and (X < min(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()))

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

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

x_ = list(map(int, input().split()))
y_ = list(map(int, input().split()))

if max(x_) > x:
    max_x = max(x_)
else:
    max_x = x

if min(y_) > y:
    min_y = y
else:
    min_y = min(y_)


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

Solution (Python):
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)
    if mx >= Y:
        print('War')
        return
    if my <= X:
        print('War')
        return
    if mx >= my:
        print('War')
        return
    print('No War')


if __name__ == '__main__':
    main()

Solution (Python):
def inpl(): return list(map(int, input().split()))
n,m,x,y = inpl()
xs = inpl()
ys = inpl()

if max(xs)>=min(ys) or y<=max(xs) or min(ys)<=x:
    print('War')
else:
    print('No War')

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

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

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