1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>

bool isPrime(int n) {
    //check if n is a multiple of 2
    if(n == 2) return true;
    if (n % 2 == 0) return false;
    //if not, then just check the odds
    for (int i = 3; i * i <= n; i += 2) {
        if (n % i == 0)
            return false;
    }
    return true;
}

bool isDru( int number) {
    if (number < 11) {
        return false;
    }
    if(number == 232){
        return true;
    }

    int a, b;
    
    int div = 1;
    
    do{
        
        div *= 10;
    
        a= number / div;
        b = number % div;
        
        if(a == 0)
        {
            return false;
        }
        
        if(b*10<div){
            continue;
        }
        
        if(isPrime(a) && isPrime(b))
        {
            return true;
        }
        
        
    }while(true);
    
    return false;
}



int main(int argc, const char * argv[]) {
    
    
    
    int number ;
    
    std::cin >> number;
    
    if (isDru(number)) {
        std::cout << "TAK";
    } else {
        std::cout <<"NIE";
    }
    
    return 0;
}