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