#include <bits/stdc++.h>
using namespace std;
bool t(int a, int b, int c) { return a + b > c && b + c > a && c + a > b; }
bool s(int a, int b, int c) { return a + b == c || a + c == b || b + c == a; }
int main(int argc, const char *argv[]) {
  ios_base::sync_with_stdio(false);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (t(a, b, c) || t(a, b, d) || t(a, c, d) || t(b, c, d))
    cout << "TRIANGLE";
  else if (s(a, b, c) || s(a, b, d) || s(a, c, d) || s(b, c, d))
    cout << "SEGMENT";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
