Z-curve is a space-filling curve which is often used in computer science. Due to its good
locality preserving behaviour it is used in data structures for mapping multidimensional
data to one dimension. The figure below shows the z-values for the two dimentional case
with coordinates 1 <= x <= 8, 1 <= y <= 8.
Now here is your job: given coordinates (x,y), find its z-value; or given a z-value, find
the its coordinates (x,y).
There are multiple test cases in the input. Each case is just a single line, containing either
two integers x and y with a pair of brackets, standing for coordinates (x,y), or just a single
integer z, standing for a z-value.
For each case, output the cooresponding z-value, or coordinates, according to the input. Refer to
sample for the correct output format.
You may assume that all integers which appear in the input and output fit in positive signed 32-bit