#include <bits/stdc++.h>
using namespace std;
int a[5];
inline void change(int &a, int &b) {
  int t = a;
  a = b;
  b = t;
}
int main() {
  ios::sync_with_stdio(0);
  for (int i = 1; i <= 4; i++) cin >> a[i];
  for (int i = 1; i <= 3; i++)
    for (int j = i + 1; j <= 4; j++)
      if (a[i] > a[j]) change(a[i], a[j]);
  if (a[3] < a[1] + a[2] || a[4] < a[1] + a[2] || a[4] < a[1] + a[3] ||
      a[4] < a[2] + a[3]) {
    cout << "TRIANGLE";
    return 0;
  }
  if (a[3] == a[1] + a[2] || a[4] == a[1] + a[2] || a[4] == a[1] + a[3] ||
      a[4] == a[2] + a[3]) {
    cout << "SEGMENT";
    return 0;
  }
  cout << "IMPOSSIBLE";
  return 0;
}
