$n, $m = gets.chomp.split(' ').map{|i| i.to_i(10)} $x, $y = gets.chomp.split(' ').map{|i| i.to_i(10)} def find_class (x, m, n) x -= 1 d = (x / m) & 1 if d == 0 then (x % m) + 1 else n - (x % m) end end if find_class($x, $m, $n) == find_class($y, $m, $n) then puts "YES" else puts "NO" end