#include <bits/stdc++.h>
using namespace std;
void merge(int a[], int p, int q, int r) {
  int c[10];
  int i = p;
  int j = q + 1;
  int k = p;
  while ((i <= q) && (j <= r)) {
    if (a[i] < a[j]) {
      c[k] = a[i];
      i = i + 1;
      k = k + 1;
    } else {
      c[k] = a[j];
      j = j + 1;
      k = k + 1;
    }
  }
  while (i <= q) {
    c[k] = a[i];
    i = i + 1;
    k = k + 1;
  }
  while (j <= r) {
    c[k] = a[j];
    j = j + 1;
    k = k + 1;
  }
  int l = p;
  while (l <= r) {
    a[l] = c[l];
    l = l + 1;
  }
}
void mergesort(int a[], int p, int r) {
  if (p < r) {
    int q = (p + r) / 2;
    mergesort(a, p, q);
    mergesort(a, q + 1, r);
    merge(a, p, q, r);
  }
}
int checkFigure(int a, int b, int c) {
  if (a < b + c) return 2;
  if (a == b + c) return 1;
  if (a > b + c) return 0;
}
int main() {
  int arr[4];
  scanf("%d%d%d%d", &arr[0], &arr[1], &arr[2], &arr[3]);
  mergesort(arr, 0, 3);
  int curid = 0;
  curid = max(curid, checkFigure(arr[3], arr[2], arr[1]));
  curid = max(curid, checkFigure(arr[3], arr[1], arr[0]));
  curid = max(curid, checkFigure(arr[3], arr[2], arr[0]));
  curid = max(curid, checkFigure(arr[2], arr[1], arr[0]));
  switch (curid) {
    case 0: {
      printf("IMPOSSIBLE");
      break;
    }
    case 1: {
      printf("SEGMENT");
      break;
    }
    case 2: {
      printf("TRIANGLE");
      break;
    }
  }
  return 0;
}
