#include <bits/stdc++.h>
using namespace std;
const int maxn = 10;
int a[maxn];
int main() {
  while (cin >> a[1] >> a[2] >> a[3] >> a[4]) {
    int signt = 0, signs = 0;
    sort(a + 1, a + 5);
    for (int i = 1; i <= 4; i++)
      for (int j = i + 1; j <= 4; j++)
        for (int k = j + 1; k <= 4; k++) {
          if (a[i] + a[j] > a[k] && a[k] - a[j] < a[i]) signt = 1;
          if (a[i] + a[j] == a[k]) signs = 1;
        }
    if (signt)
      cout << "TRIANGLE" << endl;
    else if (signs)
      cout << "SEGMENT" << endl;
    else
      cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}
