#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T lowbit(T n) {
  return (n ^ (n - 1)) & n;
}
template <class T>
inline int countbit(T n) {
  return (n == 0) ? 0 : (1 + countbit(n & (n - 1)));
}
string string_add(string b, string a) {
  if (a.size() > b.size()) swap(a, b);
  a = string((b.size() - a.size()), '0') + a;
  int carry = 0, add;
  string res;
  for (int i = a.size() - 1; i > -1; i--) {
    add = (int)(a[i] - '0') + (int)(b[i] - '0') + carry;
    carry = add / 10;
    res += (add % 10) + '0';
  }
  if (carry) res += carry + '0';
  reverse(res.begin(), res.end());
  return res;
}
string string_mul(string a, string b) {
  if (a.size() > b.size()) swap(a, b);
  string res, tres;
  int l = 0, carry, mul;
  for (int i = a.size() - 1; i > -1; i--) {
    tres = string(l, '0');
    carry = 0;
    for (int j = b.size() - 1; j > -1; j--) {
      mul = (int)(a[i] - '0') * (int)(b[j] - '0') + carry;
      carry = mul / 10;
      tres += (mul % 10) + '0';
    }
    if (carry) tres += carry + '0';
    reverse(tres.begin(), tres.end());
    res = string_add(tres, res);
    l++;
  }
  return res;
}
void cut_leading_zero(string &res) {
  int i;
  for (i = 0; i < res.size(); i++) {
    if (res[i] != '0') break;
  }
  res = res.substr(i);
  if (!res.size()) res = "0";
  return;
}
template <class T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T my_pow(T n, T p) {
  if (p == 0) return 1;
  T x = my_pow(n, p / 2);
  x = (x * x);
  if (p & 1) x = (x * n);
  return x;
}
template <class T>
T big_mod(T n, T p, T m) {
  if (p == 0) return (T)1;
  T x = big_mod(n, p / 2, m);
  x = (x * x) % m;
  if (p & 1) x = (x * n) % m;
  return x;
}
template <class T>
inline T Mod(T n, T m) {
  return (n % m + m) % m;
}
template <class T>
T multiplication(T n, T p, T m) {
  if (p == 0) return (T)0;
  T x = multiplication(n, p / 2, m);
  x = (x + x) % m;
  if (p & 1) x = (x + n) % m;
  return x;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
template <class T>
T extract(string s, T ret) {
  stringstream ss(s);
  ss >> ret;
  return ret;
}
template <class T>
string itos(T n) {
  ostringstream ost;
  ost << n;
  ost.flush();
  return ost.str();
}
long long stoi(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double toDouble(string s) {
  double r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
const int mod = 1e9 + 7;
long long a = 0, b = 0, d = 0, n, m, res = 0, c = 0, t = 0, ans = 0, cc = 0,
          f = 0, ff = 0, cnt = 0, cost = 0, ks = 0, k;
long long mn = (1e15), mx = -(1e15);
string s[100], ss;
long long ar[1001];
int main() {
  for (__typeof(4) i = 0; i < (4); i++) cin >> ar[i];
  sort(ar, ar + 4);
  if (ar[0] + ar[1] > ar[2] || ar[1] + ar[2] > ar[3])
    cout << "TRIANGLE";
  else if (ar[0] + ar[1] == ar[2] || ar[1] + ar[2] == ar[3])
    cout << "SEGMENT";
  else
    cout << "IMPOSSIBLE";
  return 0;
}
