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