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