#include <bits/stdc++.h>
int main() {
  int a, b, c, d, flag = 0;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  if (a + b > c && b + c > a && c + a > b)
    flag = 1;
  else if (b + c > d && c + d > b && d + b > c)
    flag = 1;
  else if (c + d > a && d + a > c && a + c > d)
    flag = 1;
  else if (a + b > d && b + d > a && d + a > b)
    flag = 1;
  if (flag == 1)
    printf("TRIANGLE");
  else {
    if (a + b == c || b + c == a || c + a == b)
      flag = 2;
    else if (b + c == d || c + d == b || d + b == c)
      flag = 2;
    else if (c + d == a || d + a == c || a + c == d)
      flag = 2;
    else if (a + b == d || b + d == a || d + a == b)
      flag = 2;
  }
  if (flag == 2)
    printf("SEGMENT");
  else if (flag == 0)
    printf("IMPOSSIBLE");
}
