


A sample generation tree is shown, where ‘M’ denotes the male member and ‘F’ denotes the female member.

The generation tree starts with a male member i.e. Aakash.
Every member has exactly two children.
The given N and K will always be valid.
The first line contains an integer 'T' which denotes the number of test cases. Then the test cases follow.
The first and the only line of each test case contains two space-separated integers ‘N’ and ‘K’ denoting the generation number and position of the child in Nth generation, respectively.
For each test case, print the gender of the Kth child in the Nth generation. If the gender is male, print “Male” else print “Female” (without quotes).
The output of each test case is printed in a separate line.
You don’t have to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 50
1 <= K <= 2^(N - 1)
where ‘T’ is the number of test cases, ‘N’ is generation number and ‘K’ is the position of the child in the Nth generation.
The idea is to find the gender of the parent of the Kth child in Nth generation. Now, if the Kth child of the Nth generation is the first child of its parent, then it’s gender will be the same as the parent’s gender else it will be the opposite. This can be done recursively.
Algorithm:
For example: N = 3, K = 3
We need to find the gender of the 3rd child in the 3rd generation.
Now, par = (K + 1) / 2 = (3 + 1) / 2 and generation = N - 1 = 2.
Now, we have to find the parent of the second child of the second generation.
par = (2 + 1) / 2 = 1 and generation = 1.
As the generation is 1, simply return “Male”.
Now, we know the gender of the parent of the 2nd child of the 2nd generation. As the 2nd child of the 2nd generation is the second child of its parent, its gender will be Female(opposite of the parent).
Now, we know the gender of the parent of the 3rd child of the 3rd generation. As the 3rd child of the 3rd generation is the first child of its parent, its gender will be Female( same as the parent’s).
Thus, “Female” is the required answer.