#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4];
  for (int i = 0; i < 4; i++) cin >> a[i];
  sort(a, a + 4);
  for (int i = 0; i < 2; i++)
    if (a[i] + a[i + 1] > a[i + 2]) return 0 * printf("TRIANGLE");
  for (int i = 0; i < 2; i++)
    if (a[i] + a[i + 1] == a[i + 2]) return 0 * printf("SEGMENT");
  return 0 * printf("IMPOSSIBLE");
}
