---
{"category_name":"easy","problem_code":"A3","problem_name":"The Guessing Game","languages_supported":{"0":"ADA","1":"ASM","2":"BASH","3":"BF","4":"C","5":"C99 strict","6":"CAML","7":"CLOJ","8":"CLPS","9":"CPP 4.3.2","10":"CPP 4.9.2","11":"CPP14","12":"CS2","13":"D","14":"ERL","15":"FORT","16":"FS","17":"GO","18":"HASK","19":"ICK","20":"ICON","21":"JAVA","22":"JS","23":"LISP clisp","24":"LISP sbcl","25":"LUA","26":"NEM","27":"NICE","28":"NODEJS","29":"PAS fpc","30":"PAS gpc","31":"PERL","32":"PHP","33":"PIKE","34":"PRLG","35":"PYTH","36":"PYTH 3.4","37":"RUBY","38":"SCALA","39":"SCM guile","40":"SCM qobi","41":"ST","42":"TCL","43":"TEXT","44":"WSPC"},"max_timelimit":6,"source_sizelimit":50000,"problem_author":"admin","problem_tester":null,"date_added":"1-12-2008","tags":{"0":"admin","1":"explanation","2":"game","3":"guessing","4":"guessinggame"},"editorial_url":"http://discuss.codechef.com/problems/A3","time":{"view_start_date":1389287890,"submit_start_date":1389287890,"visible_start_date":1389287890,"end_date":1735669800},"layout":"problem"}
---
<span class="solution-visible-txt">All submissions for this problem are available.</span><p>Alice and Johnny are playing a simple guessing game. Johnny picks an arbitrary positive integer <i>n</i> (1<=<i>n</i><=10<sup>9</sup>) and gives Alice exactly <i>k</i> hints about the value of <i>n</i>. It is Alice's task to guess <i>n</i>, based on the received hints.
<p>
Alice often has a serious problem guessing the value of <i>n</i>, and she's beginning to suspect that Johnny occasionally cheats, that is, gives her incorrect hints.
After the last game, they had the following little conversation:
<div align="justify">
<ul>
<li>[Alice] Johnny, you keep cheating!
<li>[Johnny] Indeed? You cannot prove it.
<li>[Alice] 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.
</ul>
</div>
<p>
So, how many times at least did Johnny lie to Alice? Try to determine this, knowing only the hints Johnny gave to Alice.
<h3>Input</h3>
<p>The first line of input contains <i>t</i>, the number of test cases (about 20). Exactly <i>t</i> test cases follow.
<p>Each test case starts with a line containing a single integer <i>k</i>, denoting the number of hints given by Johnny (1<=<i>k</i><=100000). Each of the next <i>k</i> lines contains exactly one hint. The <i>i</i>-th hint is of the form:</p>
<p>
<tt>operator</tt> <i>l<sub>i</sub></i> <tt>logical_value</tt>
</p>
<p>where <tt>operator</tt> denotes one of the symbols <tt>< </tt>, <tt>> </tt>, or <tt>=</tt>; <i>l<sub>i</sub></i> is an integer (1<=<i>l<sub>i</sub></i><=10<sup>9</sup>), while <tt>logical_value</tt> is one of the words: <tt>Yes</tt> or <tt>No</tt>. The hint is considered correct if <tt>logical_value</tt> is the correct reply to the question: "Does the relation: <i>n</i> <tt>operator</tt> <i>l<sub>i</sub></i> hold?", and is considered to be false (a lie) otherwise.
<h3>Output</h3>
<p>For each test case output a line containing a single integer, equal to the minimal possible number of Johnny's lies during the game.
<h3>Example</h3>
<pre>
<b>Input:</b>
3
2
< 100 No
> 100 No
3
< 2 Yes
> 4 Yes
= 3 No
6
< 2 Yes
> 1 Yes
= 1 Yes
= 1 Yes
> 1 Yes
= 1 Yes
<b>Output:</b>
0
1
2
</pre>
<p><b>Explanation:</b> for the respective test cases, the number picked by Johnny could have been e.g. <i>n</i>=100, <i>n</i>=5, and <i>n</i>=1.