#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  long long int a, b, c, d;
  cin >> a >> b >> c >> d;
  while (true) {
    if (a + b > c && b + c > a && a + c > b) {
      cout << "TRIANGLE";
      break;
    }
    if (a + b > d && b + d > a && a + d > b) {
      cout << "TRIANGLE";
      break;
    }
    if (d + b > c && b + c > d && d + c > b) {
      cout << "TRIANGLE";
      break;
    }
    if (a + d > c && d + c > a && a + c > d) {
      cout << "TRIANGLE";
      break;
    }
    if (a + b == c || b + c == a || a + c == b) {
      cout << "SEGMENT";
      break;
    }
    if (a + b == d || b + d == a || a + d == b) {
      cout << "SEGMENT";
      break;
    }
    if (d + b == c || b + c == d || d + c == b) {
      cout << "SEGMENT";
      break;
    }
    if (a + d == c || d + c == a || a + c == d) {
      cout << "SEGMENT";
      break;
    } else
      cout << "IMPOSSIBLE";
    break;
  }
  return 0;
}
