#include <bits/stdc++.h>
using namespace std;
int a[4];
bool check(int a, int b, int c) {
  if (a + b > c && b + c > a && a + c > b)
    return 1;
  else
    return 0;
}
bool check_seg(int a, int b, int c) {
  if (a + b == c || b + c == a || a + c == b)
    return 1;
  else
    return 0;
}
void solve() {
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  sort(a, a + 4);
  if (check(a[0], a[1], a[2]) || check(a[1], a[2], a[3])) {
    cout << "TRIANGLE";
    return;
  }
  if (check_seg(a[0], a[1], a[2]) || check_seg(a[1], a[2], a[3])) {
    cout << "SEGMENT";
    return;
  }
  cout << "IMPOSSIBLE";
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
