#include <bits/stdc++.h>
using namespace std;
const int INF = (int)(INT_MAX - 100);
const int N = (int)(0);
const long long mod = (int)(1e+9 + 7);
int main() {
  int T[4];
  bool tri = 0, seg = 0;
  for (int p = 0; p < 4; p++) cin >> T[p];
  for (int it1 = (0); it1 <= (1); it1++)
    for (int it2 = (it1 + 1); it2 <= (2); it2++)
      for (int it3 = (it2 + 1); it3 <= (3); it3++) {
        int p[3] = {it1, it2, it3};
        for (int f = 0; f < 3; f++) {
          if ((abs(T[p[(f + 1) % 3]] - T[p[(f + 2) % 3]]) < T[p[f]]) &&
              (T[p[f]] < T[p[(f + 1) % 3]] + T[p[(f + 2) % 3]]))
            tri = 1;
          if (T[p[f]] == T[p[(f + 1) % 3]] + T[p[(f + 2) % 3]]) seg = 1;
        }
      }
  if (tri) return puts("TRIANGLE"), 0;
  puts((seg ? "SEGMENT" : "IMPOSSIBLE"));
  return 0;
}
