#include <bits/stdc++.h>
using namespace std;
int triangle(int a, int b, int c) {
  if (a + b > c)
    return 0;
  else if (a + b == c)
    return 1;
  else
    return 2;
}
int main(void) {
  unordered_set<int> result;
  vector<int> seg;
  int input;
  cin >> input;
  seg.push_back(input);
  cin >> input;
  seg.push_back(input);
  cin >> input;
  seg.push_back(input);
  cin >> input;
  seg.push_back(input);
  sort(seg.begin(), seg.end());
  result.insert(triangle(seg[0], seg[1], seg[2]));
  result.insert(triangle(seg[0], seg[1], seg[3]));
  result.insert(triangle(seg[0], seg[2], seg[3]));
  result.insert(triangle(seg[1], seg[2], seg[3]));
  if (result.count(0))
    cout << "TRIANGLE" << endl;
  else if (result.count(1))
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}
