#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:33554432")
using namespace std;
const double PI = 2 * acos(0.0);
const double EPS = 1e-8;
const int INF = (1 << 30) - 1;
int n;
int a[4];
int main() {
  for (int i = 0; i < 4; ++i) cin >> a[i];
  sort(a, a + 4);
  if (a[0] + a[1] > a[2] || a[1] + a[2] > a[3])
    cout << "TRIANGLE";
  else if (a[0] + a[1] == a[2] || a[1] + a[2] == a[3])
    cout << "SEGMENT";
  else
    cout << "IMPOSSIBLE";
  return 0;
};
