#include <bits/stdc++.h>
using namespace std;
long long int a, b;
long long int x, y;
long long int n, t;
bool flag = false;
string str;
int main() {
  long long int a[4];
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  sort(a, a + 4);
  if ((a[0] + a[1] < a[2]) && (a[1] + a[2] < a[3]))
    str = "IMPOSSIBLE";
  else if (a[0] + a[1] > a[2] || a[1] + a[2] > a[3])
    str = "TRIANGLE";
  else
    str = "SEGMENT";
  cout << str;
  return 0;
}
