시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 128 MB22101062.500%

문제

You are very absorbed in a famous role-playing game (RPG), "Everlasting -Zero-". An RPG is a game in which players assume the roles of characters in a fictional setting. While you play the game, you can forget your "real life" and become a different person.

To play the game more effectively, you have to understand two notions, a skill point and a special command. A character can boost up by accumulating his experience points. When a character boosts up, he can gain skill points.

You can arbitrarily allocate the skill points to the character's skills to enhance the character's abilities. If skill points of each skill meets some conditions simultaneously (e.g., the skill points of some skills are are greater than or equal to the threshold values and those of others are less than or equal to the values) , the character learns a special command. One important thing is that once a character learned the command, he will never forget it. And once skill points are allocated to the character, you cannot revoke the allocation. In addition, the initial values of each skill is 0.

The system is so complicated that it is difficult for ordinary players to know whether a character can learn all the special commands or not. Luckily, in the "real" world, you are a great programmer, so you decided to write a program to tell whether a character can learn all the special commnads or not. If it turns out to be feasible, you will be more absorbed in the game and become happy.

입력

The input is formatted as follows.

M N
K1
s1,1 cond1,1 t1,1
s1,2 cond1,2 t1,2
...
s1,K1 cond1,K1 t1,K1
K2
...
KM
sM,1 condM,1 tM,1
sM,2 condM,2 tM,2
...
sM,KM condM,KM tM,KM

The first line of the input contains two integers (M, N), where M is the number of special commands (1 ≤ M ≤ 100), N is the number of skills (1 ≤ N ≤ 100). All special commands and skills are numbered from 1.

Then M set of conditions follows. The first line of a condition set contains a single integer Ki (0 ≤ Ki ≤ 100), where Ki is the number of conditions to learn the i-th command. The following Ki lines describe the conditions on the skill values. si,j is an integer to identify the skill required to learn the command. condi,j is given by string "<=" or ">=". If condi,j is "<=", the skill point of si,j-th skill must be less than or equal to the threshold value ti,j (0 ≤ ti,j ≤ 100). Otherwise, i.e. if condi,j is ">=", the skill point of si,j must be greater than or equal to ti,j.

출력

Output "Yes" (without quotes) if a character can learn all the special commands in given conditions, otherwise "No" (without quotes).

예제 입력 1

2 2
2 
1 >= 3
2 <= 5
2
1 >= 4
2 >= 3

예제 출력 1

Yes

예제 입력 2

2 2
2 
1 >= 5
2 >= 5
2
1 <= 4
2 <= 3

예제 출력 2

Yes

예제 입력 3

2 2
2 
1 >= 3
2 <= 3
2
1 <= 2
2 >= 5

예제 출력 3

No

예제 입력 4

1 2
2
1 <= 10
1 >= 15

예제 출력 4

No

예제 입력 5

5 5
3
2 <= 1
3 <= 1
4 <= 1
4
2 >= 2
3 <= 1
4 <= 1
5 <= 1
3
3 >= 2
4 <= 1
5 <= 1
2
4 >= 2
5 <= 1
1
5 >= 2

예제 출력 5

Yes