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