import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn._
import scala.reflect.ClassTag

object Main extends App {
  val Array(n, a, b) = readLine.trim.split(' ').map(_.toLong)
  val item = Array.fill(5){List((0L, 0L)): List[(Long, Long)]}
  for (_ ← 0L until n) {
    val Array(t, x, y) = readLine.trim.split(' ').map(_.toLong)
    item(t.toInt - 1) ::= (x, y)
  }
  val enum = (3 until 5).map(item).foldLeft(List[(Long, Long)]((0L, 0L))){
    case (acc, r) ⇒ acc.flatMap{case (x, y) ⇒ r.map{case (c, d) ⇒ (x + c, y + d)}}
  }.groupBy(_._1).toArray.sortBy(_._1)
  val compressor = new CoordinateCompressor(enum.map(_._1))
  val seg = SegTree(enum.map(_._2.map(_._2).toArray))
  if ((0 until 3).map(item).foldLeft(List[(Long, Long)]((0L, 0L))){
    case (acc, r) ⇒ acc.flatMap{case (x, y) ⇒ r.map{case (c, d) ⇒ (x + c, y + d)}}
  }.exists{case (x, y) ⇒ seg(compressor.lowerBoundOf(a - x), compressor.upperBoundOf(b - x)).exists(arr ⇒ upperBound(arr, b - y) != lowerBound(arr, a - y))}) {
    println("Yes")
  }else {
    println("No")
  }

  def lowerBound(array: Array[Long], target: Long): Int = {
    var left = 0
    var right = array.length
    while(left < right) {
      val mid = (left + right) / 2
      if (array(mid) < target) left = mid + 1
      else right = mid
    }
    right
  }
  def upperBound(array: Array[Long], target: Long): Int = {
    var left = 0
    var right = array.length
    while (left < right) {
      val mid = (left + right) / 2
      if (array(mid) <= target) left = mid + 1
      else right = mid
    }
    right
  }
}
class CoordinateCompressor[T: Ordering : ClassTag](coordinates: Seq[T]) {
  private val sorted = coordinates.sorted.toArray
  def lowerBoundOf(coordinate: T): Int = lowerBound(coordinate)
  def upperBoundOf(coordinate: T): Int = upperBound(coordinate)
  def coordinateOf(rank: Int): T = sorted(rank)
  private[this] def upperBound(target: T): Int = {
    var left = 0
    var right = sorted.length
    while (left < right){
      val mid = (left + right) / 2
      if (implicitly[Ordering[T]].compare(sorted(mid), target) <= 0) left = mid + 1
      else right = mid
    }
    right
  }
  private[this] def lowerBound(target: T): Int = {
    var left = 0
    var right = sorted.length
    while (left < right) {
      val mid = (left + right) / 2
      if (implicitly[Ordering[T]].compare(sorted(mid), target) < 0) left = mid + 1
      else right = mid
    }
    right
  }
}

object SegTree {
  def apply(values: Array[Array[Long]]): SegTree = {
    val buffer = ArrayBuffer[Array[Array[Long]]](values.map{_.sorted})
    while(buffer.last.length > 1) {
      buffer.append((0 until buffer.last.length / 2).map{i ⇒ (buffer.last(i * 2) ++ buffer.last(i * 2 + 1)).sorted}.toArray)
    }
    new SegTree(values.length, buffer.toArray)
  }
}
class SegTree private(val size: Int, private val array: Array[Array[Array[Long]]]) {
  def apply(from: Int, until: Int): List[Array[Long]] = {
    var leftResult = Nil: List[Array[Long]]
    var rightResult = Nil: List[Array[Long]]
    var left = from
    var right = until - 1
    for (depth ← array.indices if left <= right) {
      if (left % 2 == 1) {
        leftResult ::= array(depth)(left)
      }
      if (right % 2 == 0) {
        rightResult ::= array(depth)(right)
      }
      left = left / 2 + left % 2
      right = right / 2 + right % 2 - 1
    }
    leftResult ::: rightResult
  }
}
