405889: GYM102152 G The Special King
Description
Assem bought a new chess board that has a special king that move in a different way than other regular kings.
In one move, the special king can move from its position in one of the following directions: up, down, left, or right. Formally, if the special king is standing on position ($$$x$$$, $$$y$$$), in one move it can go to one of the following positions: ($$$x - 1$$$, $$$y$$$), ($$$x + 1$$$, $$$y$$$), ($$$x$$$, $$$y - 1$$$), or ($$$x$$$, $$$y + 1$$$).
Initially, the special king is standing on position ($$$x_1$$$, $$$y_1$$$) and Assem wants to place it on position ($$$x_2$$$, $$$y_2$$$). Can you help Assem by calculating the minimum number of required moves he needs to accomplish his goal?
InputThe first line contains an integer $$$T$$$ ($$$1 \le T \le 4096$$$) specifying the number of test cases,
Each test consists of a single line containing four integers $$$x_1$$$, $$$y_1$$$, $$$x_2$$$, and $$$y_2$$$ ($$$1 \le x_1, y_1, x_2, y_2 \le 8$$$), in which $$$x_1$$$ and $$$y_1$$$ are representing the starting position of the special king, and $$$x_2$$$ and $$$y_2$$$ are representing the the ending position.
OutputFor each test case, print a single line containing the minimum number of required moves to move the special king from the starting position to the ending position.
ExampleInput3 1 3 4 2 5 7 3 1 3 2 3 2Output
4 8 0Note
In the first test case, the special king needs to be moved from position ($$$1$$$, $$$3$$$) to ($$$4$$$, $$$2$$$). One possible solution is to make $$$3$$$ moves down to position ($$$4$$$, $$$3$$$), then make $$$1$$$ move to the left to position ($$$4$$$, $$$2$$$). So, the total number of moves is $$$4$$$.