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