#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans;
  ans = 0;
  long n, i, j, x[10], y, k, p;
  cin >> x[1] >> x[2] >> x[3] >> x[0];
  sort(x, x + 4);
  if (x[0] + x[1] > x[2] || x[1] + x[2] > x[3])
    cout << "TRIANGLE" << endl;
  else if (x[0] + x[1] == x[2] || x[1] + x[2] == x[3])
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
