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