#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 4;
  int a[4];
  for (int i = 0; i < n; ++i) cin >> a[i];
  bool triangle = false;
  bool segment = false;
  int ind[3];
  for (int mask = 0; mask < (1 << n); ++mask) {
    int cnt = 0;
    int q = 0;
    for (int i = 0; i < n; ++i)
      if (mask & (1 << i)) {
        ++cnt;
        if (cnt > 3) break;
        ind[q] = i;
        ++q;
      }
    if (cnt != 3) continue;
    sort(ind, ind + 3);
    bool cant = true;
    bool cans = true;
    do {
      if (a[ind[0]] + a[ind[1]] < a[ind[2]]) {
        cant = false;
        cans = false;
      }
      if (a[ind[0]] + a[ind[1]] == a[ind[2]]) {
        cant = false;
        cans = true;
      }
    } while (next_permutation(ind, ind + 3));
    if (cant) {
      triangle = true;
    }
    if (cans) {
      segment = true;
    }
  }
  if (triangle)
    cout << "TRIANGLE" << endl;
  else if (segment)
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
