#include <bits/stdc++.h>
using namespace std;
bool comp(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first && a.second < b.second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a[4], i;
  for (i = 0; i < 4; i++) {
    cin >> a[i];
  }
  sort(a, a + 4);
  if (a[1] + a[2] > a[3] || a[2] < a[1] + a[0]) {
    cout << "TRIANGLE";
  } else if (a[1] + a[2] == a[3] || a[2] == a[1] + a[0]) {
    cout << "SEGMENT";
  } else {
    cout << "IMPOSSIBLE";
  }
}
