#include <bits/stdc++.h>
using namespace std;
int a[5];
bool s[5];
int z[4];
int r;
void solve(int t) {
  if (t > 3) {
    if (z[1] + z[2] >= z[3] && z[2] + z[3] >= z[1] && z[1] + z[3] >= z[2]) {
      if (z[1] + z[2] > z[3] && z[2] + z[3] > z[1] && z[1] + z[3] > z[2]) {
        r = 2;
      } else {
        if (r != 2) r = 1;
      }
    }
    return;
  }
  for (int c = 1; c <= 4; c++) {
    if (s[c]) {
      z[t] = a[c];
      s[c] = false;
      solve(t + 1);
      s[c] = true;
    }
  }
}
int main() {
  for (int c = 1; c <= 4; c++) {
    s[c] = true;
  }
  for (int c = 1; c <= 4; c++) {
    scanf("%d", &a[c]);
  }
  solve(1);
  if (r == 0) {
    printf("IMPOSSIBLE");
  } else if (r == 1) {
    printf("SEGMENT");
  } else {
    printf("TRIANGLE");
  }
  return 0;
}
