#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a;
  for (int i = 0; i < 4; i++) {
    int dd;
    cin >> dd;
    a.push_back(dd);
  }
  sort(a.begin(), a.end());
  bool t = false;
  bool seg = false;
  do {
    if (a[0] + a[1] > a[2] && a[1] + a[2] > a[0] && a[2] + a[0] > a[1])
      t = true;
    else if (a[0] + a[1] >= a[2] && a[1] + a[2] >= a[0] && a[2] + a[0] >= a[1])
      seg = true;
  } while (next_permutation(a.begin(), a.end()));
  if (t == true)
    cout << "TRIANGLE\n";
  else if (seg == true)
    cout << "SEGMENT\n";
  else
    cout << "IMPOSSIBLE\n";
  return 0;
}
