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