#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int maxN = 1030000;
void solve() {
  long long a[4];
  for (int i = 0; i < (4); ++i) cin >> a[i];
  sort(a, a + 4);
  if (a[0] + a[1] > a[2] || a[1] + a[2] > a[3])
    cout << "TRIANGLE" << endl;
  else if (a[0] + a[1] == a[2] || a[1] + a[2] == a[3])
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  solve();
  return 0;
}
