#include <bits/stdc++.h>
using namespace std;
int is_Triangle(int a, int b, int c) {
  int t;
  if (a > b) {
    t = a;
    a = b;
    b = t;
  }
  if (a > c) {
    t = a;
    a = c;
    c = t;
  }
  if (b > c) {
    t = b;
    b = c;
    c = t;
  }
  if (a + b > c && c - a < b) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  int a[4];
  while (cin >> a[0]) {
    int flag = 0;
    cin >> a[1] >> a[2] >> a[3];
    for (int i = 0; i < 2; i++) {
      for (int j = i + 1; j < 3; j++) {
        for (int k = j + 1; k < 4; k++) {
          if (is_Triangle(a[i], a[j], a[k])) {
            flag = 1;
            break;
          }
        }
      }
    }
    if (!flag) {
      sort(a, a + 4);
      for (int i = 0; i < 2; i++) {
        for (int j = i + 1; j < 3; j++) {
          for (int k = j + 1; k < 4; k++) {
            if (a[i] + a[j] == a[k]) {
              flag = 2;
              break;
            }
          }
        }
      }
    }
    if (flag == 1)
      printf("TRIANGLE\n");
    else if (flag == 2)
      printf("SEGMENT\n");
    else
      printf("IMPOSSIBLE\n");
  }
  return 0;
}
