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