#include <bits/stdc++.h>
int main(void) {
  int i, j, k, flag = 0;
  int a[5];
  for (i = 0; i < 4; i++) scanf("%d", &a[i]);
  for (i = 0; i < 4; i++)
    for (j = 0; j < 4; j++)
      for (k = 0; i != j && j != k && i != k && k < 4; k++) {
        if (a[i] + a[j] > a[k] && a[j] + a[k] > a[i] && a[k] + a[i] > a[j]) {
          printf("TRIANGLE\n");
          return 0;
        }
        if ((a[i] + a[j]) == a[k] || a[j] + a[k] == a[i] || a[i] + a[k] == a[j])
          flag = 1;
      }
  if (flag == 1)
    printf("SEGMENT\n");
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
