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