No Ball

In the sport of cricket, a No Ball is a penalty against the fielding team, usually as a result of an illegal de- livery by the bowler. The delivery of a No Ball gives an extra run to the opponent team. It might also give a warning under some regulations — even a sus- pension if it is extreme, and an additional ball must be bowled. In addition, the only way a batsman can get out in a No Ball is run out. In Twenty20s and recently one-day cricket matches, even in some am- ateur cricket, a batsman receives a ’free hit’ on the ball after No Ball due to over stepping. This means the batsman can freely hit the ball with no danger of being out in certain ways. No Balls are not uncom- mon, especially in short form cricket, and fast bowlers tend to bowl them more often than spin bowlers, due to their longer run-up. A No Ball may be called for many reasons. The most common No Ball is front foot No Ball. If the bowler bowls without some part of the front foot landing either grounded or in the air behind the popping crease or behind the line (as in the picture above). However, umpires (on field judge in cricket) now-a-days, making mistakes to call a No Ball and teams are getting extra benefit for their mistakes. So ICPC (International Cricket Problem-solver Committee) wants to automate the process of calling No Ball. They will set a camera over the position of the line and take picture during bowling and detect the No Ball in real time. ICPC wants to give you to write a program to detect the No Ball in real time. They will provide you the image data as a 5 × 5 grid as below, ..|.. ..|>. ..|.. ..|.. ..|.. No Ball ..|.. .>|.. ..|.. ..|.. ..|.. Not a No Ball Here ‘.’ is an empty field cell, ‘|’ represents the line and ‘>’ represents the bowler’s front foot. But if the camera is malfunctioning sometimes it gives 180 degree clockwise rotated images like below, ..|.. ..|.. ..|>. ..|.. ..|.. ..|.. ..|.. .<|.. ..|.. ..|.. Normal 180 degree rotated Here, ‘|’ represents the line, ‘>’ and ‘<’ represents the front foot of bowler facing right and left respec- tively. According to the rules of No Ball and given image grid, we can say that, if the line is behind the front foot in any image then it is a No Ball, otherwise not.

2/2 Given an image as a 5 × 5 grid mentioned above, you have to detect whether the delivery is a No Ball or not. Input First line of the input contains an integer T (T ≤ 50), number of test cases. Each test case consists of 5 lines describing the 5 × 5 grid. The grid will consist of ‘.’ (dot), ‘|’, ‘<’ and ‘>’. There will be no other characters or symbols in the input. There will be exactly one of the characters from ‘<’ and ‘>’ in the input. There will be exactly one column with all ‘|’, which represents the popping crease line. There will be a blank line after each test case. Output For each test case, print the test case number and print ‘No Ball’ if the corresponding grid represents a No Ball. Otherwise, print ‘Thik Ball’. Sample Input 3 ..|.. ..|>. ..|.. ..|.. ..|.. ..|.. .>|.. ..|.. ..|.. ..|.. .|... .|... .|... .|.>. .|... Sample Output Case 1: No Ball Case 2: Thik Ball Case 3: No Ball