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