#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 5, NN = 101, oo = INT_MAX, mod = 1e9 + 7;
void debug() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug(T...);
}
void amr() {
  vector<int> v(4);
  for (int i = 0; i < 4; ++i) {
    cin >> v[i];
  }
  bool ok = false, secondok = false;
  for (int i = 0; i < 4; ++i) {
    vector<int> fake;
    for (int j = 0; j < 4; ++j) {
      if (i == j) continue;
      fake.push_back(v[j]);
    }
    sort(fake.begin(), fake.end());
    if (fake[0] + fake[1] > fake[2]) {
      ok = true;
      break;
    }
    if (fake[0] + fake[1] == fake[2]) {
      secondok = true;
    }
  }
  if (ok) {
    cout << "TRIANGLE";
  } else if (secondok) {
    cout << "SEGMENT";
  } else
    cout << "IMPOSSIBLE";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  amr();
  return 0;
}
