#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ((a + b > c && b + c > a && a + c > b) ||
      (b + c > d && c + d > b && b + d > c) ||
      (c + d > a && c + a > d && d + a > c) ||
      (d + a > b && a + b > d && d + b > a))
    cout << "TRIANGLE" << endl;
  else if ((a + b == c || b + c == a || a + c == b) ||
           (b + c == d || c + d == b || b + d == c) ||
           (c + d == a || c + a == d || d + a == c) ||
           (d + a == b || a + b == d || d + b == a))
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
