#include <bits/stdc++.h>
using namespace std;
long long int digits(long long int n) { return floor(log10(double(n))) + 1; }
void faster() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long int modularExponentiation(long long int x, long long int n,
                                    long long int M) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) {
      result = ((result % M) * (x % M)) % M;
    }
    x = ((x % M) * (x % M)) % M;
    n = n / 2;
  }
  return result % M;
}
long long int d, x, y;
void extendedEuclid(long long int A, long long int B) {
  if (B == 0) {
    d = A;
    x = 1;
    y = 0;
  } else {
    extendedEuclid(B, A % B);
    int temp = x;
    x = y;
    y = temp - (A / B) * y;
  }
}
long long int nCrModp(long long int n, long long int r) {
  if (r > n - r) r = n - r;
  long long int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = min(i, r); j > 0; j--) {
      C[j] = (C[j] + C[j - 1]);
    }
  }
  return C[r];
}
long long int modInverse(long long int A, long long int M) {
  extendedEuclid(A, M);
  return (x % M + M) % M;
}
long long int sumdigits(long long int n) {
  long long int ans = 0;
  while (n > 0) {
    ans += n % 10;
    n = n / 10;
  }
  return ans;
}
long long int less_power2(long long int n) {
  long long int i = 1;
  while (i * 2 <= n) {
    i = i * 2;
  }
  return i;
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int visited[100] = {0};
vector<int> adj[100];
void dfs(int v, int dest, string s) {
  if (v == dest) {
    cout << s << endl;
    return;
  }
  visited[v] = 1;
  for (auto x : adj[v]) {
    if (visited[x] == 0) {
      char z = x + '0';
      s += z;
      dfs(x, dest, s);
    }
  }
  visited[v] = 0;
}
int main() {
  long long int arr[4];
  cin >> arr[0] >> arr[1] >> arr[2] >> arr[3];
  sort(arr, arr + 4);
  long long int z = -1;
  if (arr[0] + arr[1] > arr[2]) {
    z = 1;
    cout << "TRIANGLE";
    return 0;
  } else if (arr[0] + arr[1] == arr[2])
    z = 0;
  if (arr[1] + arr[2] > arr[3]) {
    z = 1;
    cout << "TRIANGLE";
    return 0;
  } else if (arr[1] + arr[2] == arr[3])
    z = 0;
  if (arr[0] + arr[1] > arr[3]) {
    z = 1;
    cout << "TRIANGLE";
    return 0;
  } else if (arr[0] + arr[1] == arr[3])
    z = 0;
  if (arr[0] + arr[2] > arr[3]) {
    z = 1;
    cout << "TRIANGLE";
    return 0;
  } else if (arr[0] + arr[2] == arr[3])
    z = 0;
  if (z == 0)
    cout << "SEGMENT";
  else
    cout << "IMPOSSIBLE";
}
