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