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
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <random>
using namespace std;
void input(int &n, vector<long long> &arr) {
  long long x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr.push_back(x);
  }
}
bool brutcheck(int &n, deque<long long> &q, vector<long long> &arr) {
  long long tmpsum = 0;
  for (int i = q.size() - 1; i >= 0; i--) {
    tmpsum += q[i];
    if (tmpsum > arr[q.size() - i - 1]) return false;
  }
  return true;
}
vector<long long> solve(int &n, vector<long long> &arr) {
  long long sum = 0;
  vector<long long> result = {};
  deque<long long> q;
  for (long long x : arr) {
    q.push_back(x - sum);
    if (!brutcheck(n, q, arr)) return {};
    sum = x;
  }
  for (long long x : q) result.push_back(x);
  return result;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  vector<long long> arr;
  input(n, arr);
  vector<long long> result = solve(n, arr);
  if (result.empty()) {
    cout << "NIE\n";
  }
  else {
    cout << "TAK\n" << result.size() << "\n";
    for (long long x : result) cout << x << " ";
    cout << "\n";
  }
  return 0;
}