print((function (fh) return fh:read("*n")*(2-fh:read("*n"))-1>0 and "YES" or "NO" end)(io.stdin))