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
#include <bits/stdc++.h>
using namespace std;

void solve(int n, vector<int> a) {
  for (int k = 1; k <= n; k++) {
    for (int i = 0; i <= k; i++) {
      if (a[k] > a[i] + a[k - i]) {
        cout << "NIE\n";
        return;
      }
    }
  }

  cout << "TAK\n" << n << "\n";
  for (int i = 1; i <= n; i++) {
    cout << a[i] - a[i - 1] << " ";
  }
  cout << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;

  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  solve(n, a);
}