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