Consider a special family of Engineers and Doctors with following rules :
We can represent the situation using below diagram:
E / \ E D / \ / \ E D D E / \ / \ / \ / \ E D D E D E E D
Given level and position of a person in above ancestor tree, find profession of the person.
Input : level = 4, pos = 2 Output : Doctor Input : level = 3, pos = 4 Output : Engineer
First line of input contains number of test cases T. Each test case will be of one line. Each test case will have two space separated integers. First input represents Generation and second input represents child number.
Corresponding to each test case you have to print Doctor or Engineer in new line,based on input.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.