#include <bits/stdc++.h>
using namespace std;
int ujas(int a, int b, int c) {
  if ((a + b > c) && (a + c > b) && (b + c > a)) return 2;
  if ((a == b + c) || (b == a + c) || (c == a + b)) return 1;
  return 0;
}
int main() {
  int a, b, c, d, out = 0;
  cin >> a >> b >> c >> d;
  out = max(out, ujas(a, b, c));
  out = max(out, ujas(a, c, d));
  out = max(out, ujas(a, b, d));
  out = max(out, ujas(b, c, d));
  if (out == 2) cout << "TRIANGLE";
  if (out == 1) cout << "SEGMENT";
  if (out == 0) cout << "IMPOSSIBLE";
}
