David has elaborate hedge mazes in his garden. For each of his mazes of different sizes, he wonders how long it would take to walk between any pair of locations in and around that maze. A hedge maze of order n≥1 is constructed according to very specific instructions:
Start with S=A.
Repeat n times:
Remove all A's and all B's from S.
The resulting string gives the instructions for constructing the hedge maze. In the unbounded plane start at coordinates (0,0), facing towards (1,0) and for every F move forward one unit, for every R turn right 90 degrees, and for every L turn left 90 degrees.
After constructing the maze, identify position (x,y) with the unit square cell bounded by coordinates (x,y),(x+1,y),(x,y+1),(x+1,y+1). We can move directly between two positions (x_1,y_1), (x_2,y_2) if and only if either ∣x_1−x_2∣=1 or ∣y_1−y_2∣=1, but not both, and there is no hedge between these cells. The distance between these two positions is 1.
Given a number n and a pair of positions, find the shortest distance between these positions.
Input starts with a positive integer k (1≤k≤100), denoting the number of test cases. Each of the next k lines consists of 5 integers n, x_1, y_1, x_2, y_2, satisfying 1≤n≤50, and −252≤x_1,y_1,x_2,y_2≤252. There is no interaction between the test cases. Each specifies a single hedge maze situated alone in the unbounded plane.
Output k lines with one integer on each line, corresponding to the shortest distance between the two positions in each of the k test cases.

The shortest path from the first case in the sample input.