#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y;
};
struct line {
  double a, b, c;
};
struct circle {
  double r;
  point cen;
};
double distence(point a, point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
line ptoline(point p, point q) {
  line l;
  l.a = p.y - q.y;
  l.b = q.x - p.x;
  l.c = p.x * (q.y - p.y) + p.y * (p.x - q.x);
  return l;
}
double distoline(line A, point p) {
  double multi, divi;
  multi = abs(A.a * p.x + A.b * p.y + A.c);
  divi = sqrt(A.a * A.a + A.b * A.b);
  return multi / divi;
}
point intersect(line A, line B) {
  point p;
  p.x = (A.b * B.c - B.b * A.c) / (A.a * B.b - B.a * A.b);
  p.y = (A.a * B.c - B.a * A.c) / (B.a * A.b - A.a * B.b);
  return p;
}
circle potocir(point a, point b, point c) {
  double m1, m2;
  line A, B;
  circle p;
  A.a = b.x - a.x;
  A.b = b.y - a.y;
  A.c = (a.y * a.y - b.y * b.y + a.x * a.x - b.x * b.x) / 2;
  B.a = c.x - a.x;
  B.b = c.y - a.y;
  B.c = (a.y * a.y - c.y * c.y + a.x * a.x - c.x * c.x) / 2;
  p.cen = intersect(A, B);
  p.r = distence(p.cen, a);
  return p;
}
int main() {
  int p[5];
  for (int i = 0; i < 4; i++) cin >> p[i];
  sort(p, p + 4);
  if (p[3] < p[1] + p[2] or p[2] < p[0] + p[1])
    cout << "TRIANGLE" << endl;
  else if (p[3] == p[1] + p[2] or p[2] == p[0] + p[1])
    cout << "SEGMENT" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
}
