#include <bits/stdc++.h>
#define iostream() ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
using namespace std;
const int maxn = 1e6+7;
const int MAXN = maxn / 2;
signed main()
{
iostream();
char s[8];
cin >> s;
string a[100];
a[int('B')] = "Bachelor";
a[int('D')] = "Doctor";
a[int('M')] = "Master";
printf("%s %c%c\n,a[s[2]],s[0],s[1]);
return 0;
}