#include <bits/stdc++.h>
using namespace std;
int main() {
  int all[4];
  for (int i = 0; i < 4; i++) scanf("%d", &all[i]);
  sort(all, all + 4);
  if (all[0] + all[1] > all[2] || all[1] + all[2] > all[3])
    printf("TRIANGLE");
  else if (all[0] + all[1] == all[2] || all[1] + all[2] == all[3])
    printf("SEGMENT");
  else
    printf("IMPOSSIBLE");
}
