#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[112];
  int i;
  for (i = 0; i < 4; i++) cin >> a[i];
  sort(a, a + 4);
  int tr = 0, seg = 0, im = 0;
  if (a[1] + a[2] > a[3]) {
    tr++;
  } else if (a[0] + a[1] > a[3]) {
    tr++;
  } else if (a[0] + a[2] > a[3]) {
    tr++;
  } else if (a[0] + a[1] > a[2]) {
    tr++;
  } else if (a[0] + a[1] == a[2])
    seg++;
  else if (a[0] + a[2] == a[3])
    seg++;
  else if (a[1] + a[2] == a[3])
    seg++;
  else if (a[0] + a[1] == a[3])
    seg++;
  else
    im++;
  if (tr > 0)
    cout << "TRIANGLE" << endl;
  else if (seg > 0)
    cout << "SEGMENT" << endl;
  else if (im > 0)
    cout << "IMPOSSIBLE" << endl;
}
