Leaderboard
Showing:
Handle Score
@Ibrahim Nash 5725
@blackshadows 5685
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Complete Leaderboard
Finding Profession
Easy Accuracy: 29.63% Submissions: 7204 Points: 2

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

 

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Finding Profession

Output Window