#include<bits/stdc++.h>
using namespace std;
#define ll long long
int check(ll k){
	for (int i=2;i<=sqrt(k);i++) {
		if(k%i==0) return 0;
	}
	return k>1;
}
bool check2(ll k){
	int res=0;
	int dem=0;
	while (k){
		if(check(k%10)){
			res+=k%10;
			k/=10;
		}
		else return false;
	}
	if(check(res)) return true;
	else return false;
}

int main(){
	ll k,n; cin>>k>>n;
	string s=to_string(k); 
	if(check(k) && check2(k)&& s.size()==n) cout<<"Thoa man!";
	else cout<<"Khong thoa man!";
	return 0;
}