On the first line of the input is a positive integer, the number of test cases. Then for each test case:

A line containing a three positive integers, n < 16 and h, o < 2^{31}, specifying the order of the Hilbert curve, and the house numbers of the offered house and the local city planning office.

n h o，n-图的阶数，h-起点编号，o-终点编号，求两点直线距离，取整，图中每条小线段长度是10

图的规律要自己看，这题难在这个地方