题目描述
Problem description.
Chris brown and Rihanna are in a nxn grid(1 indexed). Chris brown want to reach Rihanna in minimum number of moves but the thing is he can move only diagonally and whatever may be the number of steps he takes it is considered as only one move unless he takes a turn. So in one move he can take as many steps as he wants but should not take a turn, if he takes a turn it is considered as another move.
Input
First line has integer T, the number of test cases
In each test case first line contains integer n
Next line contains 4 integers x1, y1, x2, y2 first two are the co-ordinates of chris brown and the next two are co-ordinates of rihanna.
Output
Print the minimum number of moves.
If he can’t reach print -1
Constraints
1<=T<=50000
1<=n<= 2^64 - 1
1<=x1,y1,x2,y2<=n
Example
Input:
2
4
1 1 3 3
4
1 1 1 3
Output:
1
2
输入格式
见题面
输出格式
见题面