#include <bits/stdc++.h>
using namespace std;
bool tri(int x, int y, int z) {
  return (x + y > z) && (z + y > x) && (z + x > y);
}
bool seg(int x, int y, int z) {
  return (x + y == z) || (z + y == x) || (z + x == y);
}
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (tri(a, b, c) || tri(a, b, d) || tri(a, c, d) || tri(b, c, d)) {
    cout << "TRIANGLE";
  } else if (seg(a, b, c) || seg(a, b, d) || seg(a, c, d) || seg(b, c, d)) {
    cout << "SEGMENT";
  } else {
    cout << "IMPOSSIBLE";
  }
}
