#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4];
  for (int i = 0; i < 4; i++) cin >> a[i];
  sort(a, a + 4);
  int t1 = 0;
  if (a[0] + a[1] > a[2] || a[1] + a[2] > a[3]) t1 = 1;
  int t2 = 0;
  if (a[2] == a[0] + a[1] || a[3] == a[0] + a[1] || a[3] == a[0] + a[2] ||
      a[3] == a[1] + a[2])
    t2 = 1;
  if (t1)
    cout << "TRIANGLE" << endl;
  else if (t2)
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
