BETA
Finding Profession
Submissions: 4221   Accuracy:

20.37%

  Difficulty: Easy
     

Consider a special family of Engineers and Doctors with following rules :

  1. Everybody has two children.
  2. First child of an Engineer is an Engineer and second child is a Doctor.
  3. First child of an Doctor is Doctor and second child is an Engineer.
  4. All generations of Doctors and Engineers start with Engineer.

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.

Examples:

Input : level = 4, pos = 2
Output : Doctor

Input : level = 3, pos = 4
Output : Engineer

Input:

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.

Output:
Corresponding to each test case you have to print Doctor or Engineer in new line,based on input.

Example:
Input:
2
4 2
3 4

Output:
Doctor
Engineer

 

** For More Input/Output Examples Use 'Expected Output' option **

Author: mabhinav


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.