package no361; import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int d = sc.nextInt(); System.out.println(kadoWins(l, d) ? "kado" : "matsu"); } public static boolean kadoWins(int l,int d) { int[] grundy = new int[l+1]; for(int i=1;i<=l;i++) { HashSet hs = new HashSet<>(); for(int l1=1;l1<=i;l1++) { for(int l2=l1+1;l2<=i;l2++) { int l3 = i - l1 - l2; if (l3 <= l2 || l3 - l1 > d) { break; } hs.add(grundy[l1] ^ grundy[l2] ^ grundy[l3]); } } for(int g=0;;g++) { if (!hs.contains(g)) { grundy[i] = g; break; } } } // System.out.println(Arrays.toString(grundy)); return grundy[l] != 0; } }