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

int n;

void czy_krol(vector <unsigned long long int> v, int i){

  while( (i != 0 && v[i - 1] < v[i]) || (i != v.size() - 1 && v[i + 1] < v[i])){
    if(i != 0 && v[i - 1] < v[i]){
      v[i] += v[i - 1];
      v.erase(v.begin() + (i - 1));
      i--;
    }
    if(i != v.size() - 1 && v[i + 1] < v[i]){
      v[i] += v[i + 1];
      v.erase(v.begin() + (i + 1));
    }
  }

  if(v.size() == 1)
    cout << "T";
  else
    cout << "N";

}


int main() {

  vector <unsigned long long int> v;

  cin >> n;
  v.resize(n);
  
  for(int i = 0; i < n; i++)
    cin >> v[i];
  
  for(int i = 0; i < n; i++)
    czy_krol(v, i);
  return 0;
}