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
#include <iostream>

using namespace std;

int factorial(int a) {
    return (a == 1 ? a : a * factorial(a-1));
}

int main(){
    int n, k;
    cin>>n>>k;

    if (n == 1 && k == 1) {
        cout<<"TAK\n"<<1;
        return 0;
    }

    if (n == 4 && k == 3) {
        cout<<"TAK\n"<<"2 4 1 3";
        return 0;
    }

    if (n*n-n %4 != 0){
        cout<<"NIE";
        return 0;
    }

    if (factorial(n)-2 < k){
        cout<<"NIE";
        return 0;
    }



    return  0;
}