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