#include <bits/stdc++.h>
using namespace std;
int main() {
    int cnt = 0;
    while (1) {
        system("./dmk > meow.in");
        system("./meow");
        if (system("./chk")) exit(0);
        cout << ++cnt << endl;
    }
}