#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[105], i;
  for (i = 1; i <= 4; ++i) cin >> a[i];
  int c1, c2, c3, check = 0;
  for (i = 1; i <= 2; ++i)
    for (int j = i + 1; j <= 3; ++j)
      for (int k = j + 1; k <= 4; ++k) {
        c1 = a[i];
        c2 = a[j];
        c3 = a[k];
        if (c1 + c2 > c3 && c1 + c3 > c2 && c2 + c3 > c1) {
          cout << "TRIANGLE";
          return 0;
        } else if (((c1 + c2 > c3) && (c1 + c3 > c2) && (c2 + c3 == c1)) ||
                   ((c1 + c2 > c3) && (c1 + c3 == c2) && (c2 + c3 > c1)) ||
                   ((c1 + c2 == c3) && (c1 + c3 > c2) && (c2 + c3 > c1)))
          check = 1;
      }
  if (check == 1)
    cout << "SEGMENT";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
