#include <bits/stdc++.h>
using namespace std;
int nums[4];
int main() {
  for (int i = 0; i < (4); ++i) {
    cin >> nums[i];
  }
  sort(nums, nums + 4);
  bool triangle = false;
  bool segment = false;
  do {
    if (nums[0] + nums[1] > nums[2] && nums[0] + nums[2] > nums[1] &&
        nums[1] + nums[0] > nums[2] && nums[1] + nums[2] > nums[0] &&
        nums[2] + nums[1] > nums[0] && nums[2] + nums[0] > nums[1])
      triangle = true;
    if (nums[0] + nums[1] == nums[2] || nums[0] + nums[2] == nums[1] ||
        nums[1] + nums[0] == nums[2] || nums[1] + nums[2] == nums[0] ||
        nums[2] + nums[1] == nums[0] || nums[2] + nums[0] == nums[1])
      segment = true;
  } while (next_permutation(nums, nums + 4));
  if (triangle) {
    cout << "TRIANGLE" << endl;
  } else if (segment) {
    cout << "SEGMENT" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
