#include <bits/stdc++.h>
using namespace std;
bool tria(int a, int b, int c) {
  if ((a + b > c) && (a + c) > b && (b + c) > a) {
    return true;
  } else {
    return false;
  }
}
bool seg(int a, int b, int c) {
  if ((a + b == c) || (a + c) == b || (b + c) == a) {
    return true;
  } else {
    return false;
  }
}
int main() {
  int a, b, c, d;
  bool triangle = false;
  bool segment = false;
  cin >> a >> b >> c >> d;
  triangle = triangle || (tria(a, b, c));
  triangle = triangle || (tria(a, b, d));
  triangle = triangle || (tria(a, c, d));
  triangle = triangle || (tria(b, c, d));
  segment = segment || (seg(a, b, c));
  segment = segment || (seg(a, b, d));
  segment = segment || (seg(a, c, d));
  segment = segment || (seg(b, c, d));
  if (triangle) {
    cout << "TRIANGLE" << endl;
  } else if (segment) {
    cout << "SEGMENT" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
