N, xLB, xRB = gets.split.map &:to_i enemies = $<.map.with_index{|s, i| [i] + s.split.map(&:to_i) }.sort_by{|i, xl, yu, xr, yd| -yd } beam = [false] * 1281 (xLB..xRB).each{|x| beam[x] = true } ans = [0] * N enemies.each{|i, xl, yu, xr, yd| hit = false (xl..xr).each{|x| if beam[x] hit = true beam[x] = false end } ans[i] = 1 if hit } puts ans