P18212 [HackerEarth] Manisha and Kejal are playing a simple guessing game. Kejal picks an arbitrary positive integer n (1 ≤ n ≤ 109) and gives Manisha exactly k hints about the value of n. It is Manisha's ta
普及
题目描述

Manisha and Kejal are playing a simple guessing game. Kejal picks an arbitrary positive integer n (1 ≤ n ≤ 109) and gives Manisha exactly k hints about the value of n. It is Manisha's task to guess n, based on the received hints.

Manisha often has a serious problem guessing the value of n, and she's beginning to suspect that Kejal occasionally cheats, that is, gives her incorrect hints. After the last game, they had the following little conversation:

[Manisha] Kejal, you keep cheating!
[Kejal] Indeed? You cannot prove it.
[Manisha] Oh yes I can. In fact, I can tell you with the utmost certainty that in the last game you lied to me at least *** times.

So, how many times at least did Kejal lie to Manisha? Try to determine this, knowing only the hints Kejal gave to Manisha.

INPUT

The first line of input contains t, the number of test cases (about 20). Exactly t test cases follow.

Each test case starts with a line containing a single integer k, denoting the number of hints given by Kejal (1 ≤ k ≤ 100000). Each of the next k lines contains exactly one hint. The i-th hint is of the form:

operator li logical_value

where operator denotes one of the symbols < , > , or =; li is an integer (1 ≤ li ≤ 109), while logical_value is one of the words: Yes or No. The hint is considered correct if logical_value is the correct reply to the question: "Does the relation: n operator li hold?", and is considered to be false (a lie) otherwise.

OUTPUT

For each test case output a line containing a single integer, equal to the minimal possible number of Johnny's lies during the game.

SAMPLE INPUT
2
2
< 100 No

100 No
3
< 2 Yes
4 Yes
= 3 No

SAMPLE OUTPUT
0
1

输入格式

见题面

输出格式

见题面

样例输入
10 5 < 100 No > 100 No = 100 No < 50 Yes > 50 Yes 2 < 2 Yes > 4 Yes 3 = 1 Yes > 1 Yes = 1 Yes 4 < 2 Yes > 1 Yes = 1 Yes = 1 Yes 8 < 2 Yes > 4 Yes = 3 No > 6 No > 8 No = 9 Yes < 7 Yes = 5 No 2 < 2 Yes > 1 Yes 3 < 2 Yes > 4 Yes = 3 No 6 < 2 Yes > 1 Yes = 1 Yes = 1 Yes > 1 Yes = 1 Yes 2 < 100 No > 100 No 4 > 54 Yes = 55 Yes < 75 Yes > 25 yes
样例输出
2 1 1 1 2 1 1 2 0 1