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

template<class C> C reversed(C c) {reverse(c.begin(),c.end()); return c;}
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(X) (X).begin(), (X).end()
#define mp make_pair
#define st first
#define nd second
typedef long long ll;
typedef pair<ll,int> pii;



int32_t main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;

    vector<pii> a(n + 2);
    a[n + 1].first = 2e9;

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

    sort(all(a));
    string res(n, 'N');

    int mini = 2;
    while(mini <= n && a[mini].first == a[mini - 1].first - a[mini - 2].first) {
        a[mini].first += a[mini - 1].first;
        ++mini;
    }

    for(int i = mini;i <= n;++i) {
        a[i].first += a[i - 1].first;
    }

    a[n + 1].first = 0;

    for(int i = n;i >= mini;--i) {
        if(a[i].first > a[i + 1].first - a[i].first)
            res[a[i].second - 1] = 'T';
        else
            break;
    }


    cout << res << "\n";

    return 0;
}