#include #include using namespace std; int L, D; int mem[501]; int grundy(int l) { if (mem[l] != -1)return mem[l]; set s; for (int i = 1; i <= l; i++) { for (int j = i + 1; l-i-j>j; j++) { int k = l - i - j; if (k - i > D)continue; s.insert(grundy(i) ^ grundy(j) ^ grundy(k)); } } int res = 0; while (s.count(res)) res++; return mem[l] = res; } int main() { cin >> L >> D; for (int i = 0; i < 501; i++) mem[i] = -1; if (grundy(L)) { cout << "kado" << endl; } else { cout << "matsu" << endl; } return 0; }