#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(0);
  int sticks[4];
  std::cin >> sticks[0] >> sticks[1] >> sticks[2] >> sticks[3];
  if (sticks[0] + sticks[1] > sticks[2] && sticks[0] + sticks[2] > sticks[1] &&
      sticks[2] + sticks[1] > sticks[0])
    std::cout << "TRIANGLE";
  else if (sticks[0] + sticks[2] > sticks[3] &&
           sticks[0] + sticks[3] > sticks[2] &&
           sticks[2] + sticks[3] > sticks[0])
    std::cout << "TRIANGLE";
  else if (sticks[0] + sticks[1] > sticks[3] &&
           sticks[0] + sticks[3] > sticks[1] &&
           sticks[1] + sticks[3] > sticks[0])
    std::cout << "TRIANGLE";
  else if (sticks[1] + sticks[2] > sticks[3] &&
           sticks[1] + sticks[3] > sticks[2] &&
           sticks[2] + sticks[3] > sticks[1])
    std::cout << "TRIANGLE";
  else if (sticks[0] + sticks[1] >= sticks[2] &&
           sticks[0] + sticks[2] >= sticks[1] &&
           sticks[1] + sticks[2] >= sticks[0])
    std::cout << "SEGMENT";
  else if (sticks[0] + sticks[2] >= sticks[3] &&
           sticks[2] + sticks[3] >= sticks[0] &&
           sticks[0] + sticks[3] >= sticks[2])
    std::cout << "SEGMENT";
  else if (sticks[0] + sticks[1] >= sticks[3] &&
           sticks[1] + sticks[3] >= sticks[0] &&
           sticks[0] + sticks[3] >= sticks[1])
    std::cout << "SEGMENT";
  else if (sticks[1] + sticks[2] >= sticks[3] &&
           sticks[2] + sticks[3] >= sticks[1] &&
           sticks[1] + sticks[3] >= sticks[2])
    std::cout << "SEGMENT";
  else
    std::cout << "IMPOSSIBLE";
}
