Problem:


Score : 200 points

Problem Statement

Our world is one-dimensional, and ruled by two empires called Empire A and Empire B.

The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.

One day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.

If there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.

X < Z \leq Y

x_1, x_2, ..., x_N < Z

y_1, y_2, ..., y_M \geq Z

Determine if war will break out.

Constraints

All values in input are integers.

1 \leq N, M \leq 100

-100 \leq X < Y \leq 100

-100 \leq x_i, y_i \leq 100

x_1, x_2, ..., x_N \neq X

x_i are all different.

y_1, y_2, ..., y_M \neq Y

y_i are all different.

Input

Input is given from Standard Input in the following format:

N M X Y
x_1 x_2 ... x_N
y_1 y_2 ... y_M

Output

If war will break out, print War; otherwise, print No War.

Sample Input 1

3 2 10 20
8 15 13
16 22

Sample Output 1

No War

The choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.

X = 10 < 16 \leq 20 = Y

8, 15, 13 < 16

16, 22 \geq 16

Sample Input 2

4 2 -48 -1
-20 -35 -91 -23
-22 66

Sample Output 2

War

Sample Input 3

5 3 6 8
-10 3 1 5 -100
100 6 14

Sample Output 3

War



Sample input:
3 2 10 20
8 15 13
16 22


Sample output:
No War

Submission status: Accepted

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

Submission status: Accepted

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

x.sort()
y.sort()

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

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
MAX_x = max(x)
MIN_y = min(y)
MAX_x = max(MAX_x, X)
MIN_y = min(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())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
border_x = max(x)
border_y = min(y)
if border_x >= border_y:
    print("War")
elif border_x<= X or border_y>= Y:
    print("War")
else:
    print("No War")

Submission status: Accepted

Solution code:
N,M,X,Y=map(int,input().split())
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
for z in range(X+1,Y,1):
    if z>max(x):
        if z<=min(y):
            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()))

X.sort(reverse=True)
Y.sort()

ok = False
for z in range(x + 1, y + 1):
    if X[0] < z and Y[0] >= z:
        ok = True
        break

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

Submission status: Accepted

Solution code:
N,M,X,Y = list(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[0] + 1):
  if x[-1] < Z and y[0] <= Z and X < Z and Z <= 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()))
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())
x = list( map(int,input().split()))
y = list( map(int,input().split()))
if ((X<max(x)+1<=Y) & (max(x)< min(y))):
  print('No War')
else :
  print('War')

Submission status: Accepted

Solution code:

def main():
    N,M,X,Y = map(int,input().split())
    x_s = list(map(int,input().split()))
    y_s = list(map(int,input().split()))

    ok = False
    for z in range(X+1,Y+1):
        if z > max(x_s) and z <= min(y_s):
            ok = True
            break

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem B - 1 Dimensional World's Tale

# input
N, M, X, Y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))

# initialization
is_ok = True
x_koho = [X]
y_koho = [Y]

# x select
for x in x_list:
    if x>=X:
        x_koho.append(x)

# y select
for y in y_list:
    if y<=Y:
        y_koho.append(y)

x_max = max(x_koho)
y_min = min(y_koho)

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

Submission status: Accepted

Solution code:
n,m,x,y,*a=map(int,open(0).read().split())
X,Y=max(a[:n]),min(a[n:])
print("No War" if X<y and x<Y and X<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()))
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 = [int(i) for i in input().split()]
x_pos = [int(i) for i in input().split()]
y_pos = [int(i) for i in input().split()]

left, right = max(x_pos), min(y_pos)
ans = 'War'
for z in range(X + 1, Y + 1):
    if left < z <= right:
        ans = 'No War'
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-OneDimensionalWorldsTale.py
#

n, y, x, y = map(int, input().split())
x_under = [int(i) for i in input().split()]
y_under = [int(i) for i in input().split()]
max_x_under = max(x_under)
min_y_under = min(y_under)

for z in range(x+1, y+1):
    if max_x_under < z <= min_y_under:
        print("No War")
        exit()

print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int, input().split())
list_x = list(map(float, input().split()))
list_y = list(map(float, input().split()))
if X<Y:
	if max(list_x)<min(list_y) and X<min(list_y) and Y>max(list_x):
	  print("No War")
	
	else:
		print("War")
      
    
else:
	if max(list_x)>min(list_y) and Y<min(list_x):
	  print("No War")
    
	else:
	  print("War")

Submission status: Accepted

Solution code:
N,M,X,Y,*H=map(int,open(0).read().split());print('NWoa rW a r'[max(max(H[:N]),X)>=min(min(H[N:]),Y)::2])

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x_list = list(map(int, input().split()))
x_list.append(X)
y_list = list(map(int, input().split()))
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()))

if max(X) >= min(Y) or max(X) >= y or min(Y) <= x:
    print("War")
else:
    print("No 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()))
a = True
for i in range(-100,100):
    if x < i <= y and max(xx) < i <= min(yy):
        a = False
        break
print('War' if a else '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)+1
d = min(b)
e = 0

if c > d:
    print("War")
else:
    for i in range(c,d+1):
        if x < i and i <= y:
            print("No War")
            e = 1
            break
    if e == 0:
        print("War")

Submission status: Accepted

Solution code:
def i(): return list(map(int, input().split()))
*_, x, y = i()
print("No "*(max(i() + [x]) < min(i() + [y])) + "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()))

for i in range(x,y+1):
    if all([p < i for p in a]) and all([q >=i for q in b]) and x < i <= y:
        print("No War")
        exit()
print("War")

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split())
x = 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")

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)
ans = 'War'
for z in range(X+1, Y+1):
    if z > max_x and z <= min_y:
        ans = 'No War'
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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

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

Submission status: Accepted

Solution code:
n,m,X,Y = map(int,input().split())
x = list(map(int,input().split())) + [X]
y = list(map(int,input().split())) + [Y]
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()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#ABC-110-B
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

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

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

Submission status: Accepted

Solution code:
N,M,X,Y = map(int,input().split(" "))
x = [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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
ans = 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")

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,m,x,y=map(int,input().split())
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")

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

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""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()

Submission status: Accepted

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

Submission status: Accepted

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


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

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

a = X[-1]+1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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)
a = sorted(x)[-1]
b = sorted(y)[0]
if a < b:
	print("No War")
else:
	print("War")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import collections

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

max_x=max([X]+xlist)
min_y=min([Y]+ylist)
#print(max_x,min_y)
if max_x<min_y:
  print("No War")
else:
  print("War")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = sorted(map(int, input().split()))
y = sorted(map(int, input().split()))
 
if x[-1] < y[0]:
  if Y <= x[-1] or y[0] <= X:
    print('War')
  else:
    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)
if y_min - x_max > 0 and Y - x_max > 0 and y_min - X > 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()))
s = "No War"
if max(x) >= min(y) or min(y) < X + 1 or Y < max(x) + 1:
    s = "War"
print(s)

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()))
ans = "War"
if min(min(list_Y),y) > max(max(list_X), x):
    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())))
l = max(x)
r = min(y)
if l >= r:
    print("War")
else:
    if X < r <= 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()))

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
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')

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)

ans="War"
for i in range(X+1,Y):
  if mx<i<=my:
    ans="No War"
    break
    
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()))
Mx=max(x)
my=min(y)
if Mx<my and Mx<Y and X<my:
  print("No War")
else:
  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()]

checker = 0

#x < z <= y
for z in range(x+1,y+1):
    #x1,x2,... < z かつ y1,y2... >= z
    if max(xs) < z and min(ys) >= z:
        checker = 1

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

Submission status: Accepted

Solution code:

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

print("No War" if max(x) < min(y) and X < min(y) and min(y) < 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.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")

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

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)

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

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)

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)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
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')

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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