#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, tcase = 1;
  int kp[4];
  while (scanf("%d %d %d %d", &kp[0], &kp[1], &kp[2], &kp[3]) == 4) {
    sort(kp, kp + 4);
    int mark = 0;
    for (int i = 0; i < 4; i++) {
      for (int j = i + 1; j < 4; j++) {
        for (int k = j + 1; k < 4; k++) {
          if (kp[k] < kp[i] + kp[j]) {
            mark = 1;
            break;
          }
        }
      }
    }
    if (!mark) {
      for (int i = 0; i < 4; i++) {
        for (int j = i + 1; j < 4; j++) {
          for (int k = j + 1; k < 4; k++) {
            if (kp[k] == kp[i] + kp[j]) {
              mark = 2;
              break;
            }
          }
        }
      }
    }
    if (mark == 0)
      printf("IMPOSSIBLE\n");
    else if (mark == 1)
      printf("TRIANGLE\n");
    else
      printf("SEGMENT\n");
  }
}
