SP33049 ADACHESS - Ada and Chess

Description

Ada the Ladybug was playing [chess](https://en.wikipedia.org/wiki/Chess_piece) agains her good friend Velvet Mite Vinit. They were talking to each other during the game, saying "I will take your _figure_ in next **X** moves". After the game, this was really bugging Ada so she have decided to give it more thinking. As she can't determine it "that fast", she asked you to make a program which could output the minimal number of moves in which two figures could get to each other (note they they don't have to alternate, so all the moves could be done only by one of the figeres). Also note that it is classical **8x8** chessboard. The interesting figures will be: **King, Knight, Queen, Tower, Bishop**

Input Format

The first line of input will contain **1 , the number of test-cases.** Each of the testcases will contain 6 integers **f x y F X Y**, where **0 are the types of figures (0 to 4 standing for **King, Knight, Queen, Tower, Bishop** in this order) and **0 , the coordinates of given figures.****

Output Format

For each test-case output the minimal number of moves get both figures to same "box". In case the figures can't meet, output "**INF**".