#include <bits/stdc++.h>
using namespace std;
bool traingle(int a, int b, int c) {
  if ((a + b > c) && (a + c > b) && (b + c > a)) return true;
  return false;
}
bool degenerate(int a, int b, int c) {
  if ((a + b == c) || (a + c == b) || (b + c == a)) return true;
  return false;
}
int main() {
  int arr[4];
  int a, b, c;
  for (int i = 0; i < 4; i++) {
    cin >> arr[i];
  }
  for (int j = 0; j < 4; j++) {
    a = arr[j];
    b = arr[(j + 1) % 4];
    c = arr[(j + 2) % 4];
    if (traingle(a, b, c)) {
      cout << "TRIANGLE" << endl;
      return 0;
    }
  }
  for (int j = 0; j < 4; j++) {
    a = arr[j];
    b = arr[(j + 1) % 4];
    c = arr[(j + 2) % 4];
    if (degenerate(a, b, c)) {
      cout << "SEGMENT" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}
