#include <bits/stdc++.h>
using namespace std;
int a[5];
int main() {
  cin >> a[1] >> a[2] >> a[3] >> a[4];
  sort(a + 1, a + 4 + 1);
  if (a[2] + a[3] > a[4] || a[1] + a[2] > a[4] || a[1] + a[3] > a[4] ||
      a[1] + a[2] > a[3]) {
    cout << "TRIANGLE";
  } else {
    if (a[1] + a[2] == a[4] || a[1] + a[2] == a[3] || a[1] + a[3] == a[4] ||
        a[2] + a[3] == a[4]) {
      cout << "SEGMENT";
    } else {
      cout << "IMPOSSIBLE";
    }
  }
  return 0;
}
