program main
implicit None
integer::n,m,x,y,i,p,q
integer,allocatable::a(:),b(:)

read *,n,m,x,y
allocate(a(n))
allocate(b(m))
p = x
q = y

read *,a
read *,b

do i = 1,n
	if (a(i) > p)then
		p = a(i)
	endif
enddo

do i = 1,n
	if (b(i) < q)then
	q = b(i)
	endif
enddo

if (p < q)then
	print 101,"no war"
	else
		print 101,"war"
endif

101 format(a)
end program main