#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  int num[5];
  for (int i = 1; i <= 4; i++) cin >> num[i];
  sort(num + 1, num + 5);
  a = num[1], b = num[2], c = num[3], d = num[4];
  if (a + b > c || b + c > d)
    cout << "TRIANGLE";
  else if (a + b == c || b + c == d)
    cout << "SEGMENT";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
