#include <bits/stdc++.h>
using namespace std;
int fun(int a, int b, int c) {
  if (a + b == c || a + c == b || b + c == a) return 1;
  if (a + b > c && a + c > b && c + b > a) return 2;
  return 0;
}
int main() {
  long long int i, j, k, n, m, p, a, b, c, d;
  long long int v[4];
  cin >> v[0] >> v[1] >> v[2] >> v[3];
  sort(v, v + 4);
  i = 0;
  i |= fun(v[0], v[1], v[2]);
  i |= fun(v[0], v[1], v[3]);
  i |= fun(v[0], v[2], v[3]);
  i |= fun(v[1], v[2], v[3]);
  if (i >= 2)
    cout << "TRIANGLE" << endl;
  else if (i == 1)
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE\n";
  return 0;
}
