#include <bits/stdc++.h>
using namespace std;
int p[4];
bool flag;
int main() {
  cin >> p[0] >> p[1] >> p[2] >> p[3];
  sort(p, p + 4);
  for (int i = 0; i <= 1; i++) {
    for (int j = i + 1; j <= 2; j++) {
      for (int k = j + 1; k <= 3; k++) {
        if (p[i] + p[j] > p[k]) {
          cout << "TRIANGLE" << endl;
          return 0;
        }
        if (p[i] + p[j] == p[k]) flag = true;
      }
    }
  }
  if (!flag)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << "SEGMENT" << endl;
  return 0;
}
