human
Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the game on 8 to 8 board to too simple, he uses an infinite one instead.

The first task he faced is to check whether the king is in check. Anton doesn't know how to implement this so he asks you to help.

Consider that an infinite chess board contains one white king and the number of black pieces. There are only rooks, bishops and queens, as the other pieces are not supported yet. The white king is said to be in check if at least one black piece can reach the cell with the king in one move. 

Help Anton and write the program that for the given position determines whether the white king is in check.

Remainder, on how do chess pieces move: 

  * Bishop moves any number of cells diagonally, but it can't "leap" over the occupied cells. 
  * Rook moves any number of cells horizontally or vertically, but it also can't "leap" over the occupied cells. 
  * Queen is able to move any number of cells horizontally, vertically or diagonally, but it also can't "leap". 

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 500 000) — the number of black pieces.

The second line contains two integers x0 and y0 ( - 109 ≤ x0, y0 ≤ 109) — coordinates of the white king.

Then follow n lines, each of them contains a character and two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — type of the i-th piece and its position. Character 'B' stands for the bishop, 'R' for the rook and 'Q' for the queen. It's guaranteed that no two pieces occupy the same position.

Output

The only line of the output should contains "YES" (without quotes) if the white king is in check and "NO" (without quotes) otherwise.

Examples

Input

2
4 2
R 1 1
B 1 5

Output

YES

Input

2
4 2
R 3 3
B 1 5

Output

NO

Note

Picture for the first sample: 

 White king is in check, because the black bishop can reach the cell with the white king in one move. The answer is "YES".

Picture for the second...
Solve the task in PYTHON.
 What is a the Python program you requested?
assistant
#Here is the Python program you requested.

#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    n = int(input())
    x0, y0 = map(int, input().split())

    straight = [[float('inf'), 'N'], [float('inf'), 'N'], [float('inf'), 'N'], [float('inf'), 'N']]
    diagonal = [[float('inf'), 'N'], [float('inf'), 'N'], [float('inf'), 'N'], [float('inf'), 'N']]

    for _ in range(n):
        t, x, y = input().split()
        x, y = int(x), int(y)
        rx, ry = x - x0, y - y0

        if abs(rx) == abs(ry):
            if rx < 0 and ry < 0 and abs(rx) < diagonal[0][0]:
                diagonal[0] = [abs(rx), t]
            if rx < 0 and ry > 0 and abs(rx) < diagonal[1][0]:
                diagonal[1] = [abs(rx), t]
            if rx > 0 and ry < 0 and abs(rx) < diagonal[2][0]:
                diagonal[2] = [abs(rx), t]
            if rx > 0 and ry > 0 and abs(rx) < diagonal[3][0]:
                diagonal[3] = [abs(rx), t]

        if rx == 0 or ry == 0:
            if rx == 0 and ry < 0 and abs(ry) < straight[0][0]:
                straight[0] = [abs(ry), t]
            if rx == 0 and ry > 0 and abs(ry) < straight[1][0]:
                straight[1] = [abs(ry), t]
            if rx < 0 and ry == 0 and abs(rx) < straight[2][0]:
                straight[2] = [abs(rx), t]
            if rx > 0 and ry == 0 and abs(rx) < straight[3][0]:
                straight[3] = [abs(rx), t]

    print("YES" if any(j in 'RQ' for _, j in straight) or any(j in 'BQ' for _, j in diagonal) else "NO")

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b =...