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
#include <iostream>
#include <string>
#include <set>
#include <array>
#include <vector>
#include <numeric>

using namespace std;


int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> A(n);
    for (auto &a:A) cin >> a;
    
    for (int i=1; i<n; i++)
        for (int j=0, k=i-1; j<=k; j++, k--)
            if (A[j]+A[k]<A[i]) {
                cout << "NIE\n";
                return 0;
            }
            
    adjacent_difference(A.begin(), A.end(), A.begin());
    cout << "TAK\n";
    cout << n << '\n';
    for (auto &a:A) cout << a << ' ';
    cout << '\n';
    
    return 0;
}