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