#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  for (int i = 1; i <= 4; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  int na = 0;
  for (int i = 3; i >= 0; i--) {
    for (int j = i - 1; j >= 0; j--) {
      for (int k = j - 1; k >= 0; k--) {
        if ((v[i] < (v[j] + v[k]))) {
          cout << "TRIANGLE" << endl;
          na = 1;
          break;
        }
      }
      if (na == 1) break;
    }
    if (na == 1) break;
  }
  if (na == 0) {
    for (int i = 3; i >= 0; i--) {
      for (int j = i - 1; j >= 0; j--) {
        for (int k = j - 1; k >= 0; k--) {
          if ((v[i] == (v[j] + v[k]))) {
            cout << "SEGMENT" << endl;
            na = 1;
            break;
          }
        }
        if (na == 1) break;
      }
      if (na == 1) break;
    }
  }
  if (na == 0) cout << "IMPOSSIBLE" << endl;
  return 0;
}
