#include <bits/stdc++.h>
int temp[10];
void mergearray(int i, int mid, int j, int *output) {
  int p = i, q = mid + 1, in = 0;
  while ((p <= mid) || (q <= j)) {
    if (p > mid) {
      temp[in] = output[q];
      q++;
    } else if (q > j) {
      temp[in] = output[p];
      p++;
    } else if (output[p] < output[q]) {
      temp[in] = output[p];
      p++;
    } else {
      temp[in] = output[q];
      q++;
    }
    in++;
  }
  while (--in >= 0) output[i + in] = temp[in];
  return;
}
void mergesort(int i, int j, int *output) {
  if (i == j) return;
  int mid = (i + j) / 2;
  mergesort(i, mid, output);
  mergesort(mid + 1, j, output);
  mergearray(i, mid, j, output);
}
int main() {
  int arr[4], i, j, k, flag = 0;
  for (i = 0; i < 4; i++) scanf("%d", &arr[i]);
  mergesort(0, 3, arr);
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      if (j == i) continue;
      for (k = 0; k < 4; k++) {
        if (k == j || k == i) continue;
        if (arr[i] + arr[j] > arr[k] && arr[i] + arr[k] > arr[j] &&
            arr[j] + arr[k] > arr[i]) {
          flag = 1;
          printf("TRIANGLE\n");
          break;
        } else if (arr[i] + arr[j] == arr[k]) {
          flag = 2;
        }
      }
      if (flag == 1) break;
    }
    if (flag == 1) break;
  }
  if (flag == 0)
    printf("IMPOSSIBLE\n");
  else if (flag == 2)
    printf("SEGMENT\n");
  return 0;
}
