#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 4;
  int A[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  int cnt1 = 0, cnt2 = 0;
  sort(A, A + n);
  for (int i = 0; i < n - 1; i++) {
    long long int a = A[i] + A[i + 1];
    if (a > A[i + 2]) cnt1++;
    if (a == A[i + 2]) cnt2++;
  }
  if (cnt1 > 0) {
    cout << "TRIANGLE";
    return 0;
  }
  if (cnt2 > 0) {
    cout << "SEGMENT";
    return 0;
  }
  cout << "IMPOSSIBLE";
  return 0;
}
