#include <bits/stdc++.h>
int max(int, int);
int min(int, int);
int max(int x, int y) {
  if (x > y)
    return x;
  else
    return y;
}
int min(int x, int y) {
  if (x < y)
    return x;
  else
    return y;
}
int solve(int x, int y, int z) {
  if (x + y < z) return 0;
  if (x + y == z) return 1;
  if (x + z < y) return 0;
  if (x + z == y) return 1;
  if (y + z < x) return 0;
  if (y + z == x) return 1;
  return 2;
}
int main() {
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  int temp = 0;
  temp = max(solve(a, b, c), temp);
  temp = max(solve(a, b, d), temp);
  temp = max(solve(a, c, d), temp);
  temp = max(solve(b, c, d), temp);
  if (temp == 0) printf("IMPOSSIBLE\n");
  if (temp == 1) printf("SEGMENT\n");
  if (temp == 2) printf("TRIANGLE\n");
  return 0;
}
