#include <bits/stdc++.h>
using namespace std;
int a[5];
int b[3];
int main() {
  for (int i = 0; i < 4; i++) {
    cin >> a[i];
  }
  int flag = 0;
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 4; j++) {
      for (int k = j + 1; k < 4; k++) {
        b[0] = a[i];
        b[1] = a[j];
        b[2] = a[k];
        sort(b, b + 3);
        if (b[0] + b[1] > b[2]) {
          flag = 1;
          break;
        }
      }
    }
  }
  if (flag == 0) {
    for (int i = 0; i < 4; i++) {
      for (int j = i + 1; j < 4; j++) {
        for (int k = j + 1; k < 4; k++) {
          b[0] = a[i];
          b[1] = a[j];
          b[2] = a[k];
          sort(b, b + 3);
          if (b[0] + b[1] == b[2]) {
            flag = -1;
            break;
          }
        }
      }
    }
  }
  if (flag == 1) {
    cout << "TRIANGLE" << endl;
  } else if (flag == -1) {
    cout << "SEGMENT" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}
