#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int t = 0;
  if ((a + b > c && a + c > b && c + b > a))
    t = 1;
  else if (a + b > d && a + d > b && b + d > a)
    t = 1;
  else if (a + c > d && a + d > c & d + c > a)
    t = 1;
  else if (b + c > d && c + d > b && b + d > c)
    t = 1;
  if (t == 1)
    cout << "TRIANGLE" << endl;
  else {
    if ((a + b == c || a + c == b || c + b == a))
      t = 1;
    else if (a + b == d || a + d == b || b + d == a)
      t = 1;
    else if (a + c == d || a + d == c || d + c == a)
      t = 1;
    else if (b + c == d || c + d == b || b + d == c)
      t = 1;
    if (t == 1) cout << "SEGMENT" << endl;
  }
  if (t == 0) cout << "IMPOSSIBLE" << endl;
  return 0;
}
