#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = 2 * acos(0.0);
const double eps = 1e-6;
const int mod = 1000007;
const int N = 1000 + 5;
const int M = 2e5 + 5;
int main() {
  int a[5];
  for (int i = 0; i < 4; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + 4);
  int flag = 0;
  for (int i = 0; i < 2; i++) {
    if (a[i] + a[i + 1] > a[i + 2]) {
      flag = 1;
      break;
    } else if (a[i] + a[i + 1] == a[i + 2])
      flag = 2;
  }
  if (flag == 1)
    puts("TRIANGLE");
  else if (flag == 2)
    puts("SEGMENT");
  else
    puts("IMPOSSIBLE");
  return 0;
}
