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