#include <bits/stdc++.h>
using namespace std;
bool IsTriangle(int a, int b, int c) {
  if (a <= 0 || b <= 0 || c <= 0) return false;
  return ((a + b) > c && (a + c) > b && (b + c) > a);
}
bool CanConstructTriangle(const vector<int>& stick_lengths) {
  size_t number_of_sticks = stick_lengths.size();
  if (number_of_sticks != 4) return false;
  return (IsTriangle(stick_lengths[0], stick_lengths[1], stick_lengths[2]) ||
          IsTriangle(stick_lengths[0], stick_lengths[1], stick_lengths[3]) ||
          IsTriangle(stick_lengths[0], stick_lengths[2], stick_lengths[3]) ||
          IsTriangle(stick_lengths[1], stick_lengths[2], stick_lengths[3]));
}
bool IsSegment(int a, int b, int c) {
  return (a == (b + c) || b == (a + c) || c == (a + b));
}
bool CanConstructSegment(const vector<int>& stick_lengths) {
  size_t number_of_sticks = stick_lengths.size();
  if (number_of_sticks != 4) return false;
  return (IsSegment(stick_lengths[0], stick_lengths[1], stick_lengths[2]) ||
          IsSegment(stick_lengths[0], stick_lengths[1], stick_lengths[3]) ||
          IsSegment(stick_lengths[0], stick_lengths[2], stick_lengths[3]) ||
          IsSegment(stick_lengths[1], stick_lengths[2], stick_lengths[3]));
}
int main() {
  vector<int> stick_lengths(4, -1);
  while (cin >> stick_lengths[0] >> stick_lengths[1] >> stick_lengths[2] >>
         stick_lengths[3]) {
    if (CanConstructTriangle(stick_lengths))
      cout << "TRIANGLE" << endl;
    else if (CanConstructSegment(stick_lengths))
      cout << "SEGMENT" << endl;
    else
      cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
