The Grand Adventure
We’d like to know if Jim will be able to complete his adventure before he even starts!
Input
The first line contains a single integer $n$, $1 \le n \le 5$, the number of adventures. Each of the next $n$ lines contains a single string $a$, a sequence of $\{ \$ , *, , t, j, b, .\} $. An example of this adventure string is:
....$...$...*..*......t...j..j...b..b...
where,

$ represents Money

 represents Incense

* represents Gem

t represents a Trader

j represents a Jeweler

b represents a Banker

. represents the Ground (nothing)
and $1 \leq a \leq 100$ where $a$ is the length of string $a$. There is no limit on the number of items Jim may place in his backpack.
Output
Print YES if Jim is able to finish his adventure and print NO if he is unable to.
Sample Input 1  Sample Output 1 

5 .$.b..t.*.j.................$$$$$bbbbb....tt..... .$.b..t.*.j.. ................................ .......$....$......*....*...........t........j...j.....b..b........ ...$.$.$..*..*..*...*....*..b.....*******... 
YES YES YES YES NO 
Sample Input 2  Sample Output 2 

4 ........$b...$$..t...*..*...j.........j... .........*****jjjj...............tj.... .$..*.$..*.$..*.j.t.b.j.t.b.j.t.b. ...$$..$$..$$....$$..b......b....t..bbbbbb.....j... 
NO YES YES NO 