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