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