#include <bits/stdc++.h>
using namespace std;
int main() {
  int tab[4], a;
  bool testT = false, testS = false;
  cin >> tab[0] >> tab[1] >> tab[2] >> tab[3];
  sort(tab, tab + 4);
  a = max(tab[0] + tab[1] - tab[2], tab[1] + tab[2] - tab[3]);
  if (a > 0)
    cout << "TRIANGLE";
  else if (a)
    cout << "IMPOSSIBLE";
  else
    cout << "SEGMENT";
  return 0;
}
