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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <bits/stdc++.h>

#define ALL(v) v.begin(), v.end()
#define REP(i, a, b) for (int i = a; i < b; i++)
#define REPD(i, a, b) for (int i = a; i > b; i--)
#define REPLL(i, a, b) for (ll i = a; i < b; i++)
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define FORD(i, a, b) for (int i = a; i >= b; i--)
#define FORLL(i, a, b) for (ll i = a; i <= b; i++)

using namespace std;

typedef long long ll;
typedef long double ld;

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef pair<ld, ld> pld;

#define remax(a, b) a = max(a, b)
#define remin(a, b) a = min(a, b)

#define popcount __builtin_popcount
#define pb push_back
#define mp make_pair
#define st first
#define y first
#define nd second
#define x second

#define eps 1e-9
#define pi acos(-1.0)

#ifdef LOCAL
#define ASSERT(x) assert(x)
#else
#define cerr if(0)cout
#define ASSERT(x) ;
#endif

template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class T> ostream &operator<<(ostream& os, set<T> V) {
  os << "{"; for (auto vv : V) os << vv << ","; return os << "}";
}

vector<ll> res;
ll sum;

// a/b >= c/d
// a*d >= b*c
bool f(ll a, ll b, ll c, ll d) {
  return a*d >= b*c;
}

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

  int n; cin >> n;
  ll last_a;
  FORLL(b, 1, n) {
    ll a; cin >> a;
    if(b == 1 || f(last_a, b-1, a, b)) {
      res.pb(a - sum);
      sum += res.back();
      last_a = a;
    } else {
      cout << "NIE" << endl;
      return 0;
    }
  }
  cout << "TAK" << endl;
  cout << res.size() << endl;
  for(auto x : res) {
    cout << x << " ";
  }
  cout << endl;
  return 0;
}