#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, case1, case2, case3, case4;
  cin >> a >> b >> c >> d;
  case1 = abs(pow(a, 2) + pow(b, 2) - pow(c, 2)) - 2 * a * b;
  case2 = abs(pow(a, 2) + pow(b, 2) - pow(d, 2)) - 2 * b * a;
  case3 = abs(pow(a, 2) + pow(c, 2) - pow(d, 2)) - 2 * a * c;
  case4 = abs(pow(b, 2) + pow(c, 2) - pow(d, 2)) - 2 * b * c;
  if ((case1 < 0) || (case2 < 0) || (case3 < 0) || (case4 < 0)) {
    cout << "TRIANGLE";
  } else if ((case1 == 0) || (case2 == 0) || (case3 == 0) || (case4 == 0)) {
    cout << "SEGMENT";
  } else
    cout << "IMPOSSIBLE";
  return 0;
}
