#include <bits/stdc++.h>
using namespace std;
int arr[4], t = 0, s = 0;
int main() {
  for (int i = 0; i < 4; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + 4);
  for (int i = 0; i < 2; i++) {
    for (int j = i + 1; j < 3; j++) {
      if (arr[i] + arr[j] > arr[j + 1]) {
        t = 1;
      } else if (arr[i] + arr[j] == arr[j + 1]) {
        s = 1;
      }
    }
  }
  if (t == 1) {
    cout << "TRIANGLE";
  } else if (s == 1) {
    cout << "SEGMENT";
  } else
    cout << "IMPOSSIBLE";
  return 0;
}
