#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)
    cout << "TRIANGLE";
  else if (a + b > d && b + d > a && a + d > b)
    cout << "TRIANGLE";
  else if (a + c > d && c + d > a && a + d > c)
    cout << "TRIANGLE";
  else if (c + b > d && b + d > c && c + d > b)
    cout << "TRIANGLE";
  else if (a + b == c || a + b == d || a + c == d || a + c == b || a + d == b ||
           a + d == c || b + c == a || b + c == d || c + d == a || c + d == b ||
           b + d == c || b + d == a)
    cout << "SEGMENT";
  else
    cout << "IMPOSSIBLE";
}
