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