#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; int L, D, dp[600]; int f(int l){ int &r = dp[l]; if(r != -1)return r; set st; FOR(a, 1, l)FOR(b, a + 1, l-a){ int c = l - a - b; if(c > 0 && a != b&&b != c&&c != a && max({a,b,c}) - min({a,b,c}) <= D) st.insert(f(a) ^ f(b) ^ f(c)); } r = 0; while(st.count(r))r++; return r; } int main(){ ios::sync_with_stdio(0); cin.tie(0); while(cin >> L >> D){ MEM(dp, -1); dp[0] = 0; cout << (f(L) ? "kado" : "matsu") << endl; } }