import math
x=input().split()
for i in range(0,len(x)):
x[i]=int(x[i])
x.sort()
a,b,c,d=x[3],x[2],x[1],x[0]
if a<b+c or a<c+d or a<b+d or b<c+d:
print ("TRIANGLE")
elif a==b+c or a==c+d or a==b+d or b==c+d:
print("SEGMENT")
else:
print ("IMPOSSIBLE")
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int t=1;
// cin>>t;
while(t--)
{
ll a,b,x,n,d,ans=0;
ll aa[4];
set<int>s;
for(int i=0;i<4;i++)
{
cin>>aa[i];
s.insert(aa[i]);
}
sort(aa,aa+4);
//ll mx=aa[0];
if(aa[0]+aa[1]>aa[2] || aa[1]+aa[2]>aa[3]|| aa[0]+aa[2]>aa[3])
{
cout<<"TRIANGLE"<<endl;
}
else if(aa[2]==aa[0]+aa[1] || aa[3]==aa[1]+aa[2])
{
cout<<"SEGMENT"<<endl;
}
else
cout<<"IMPOSSIBLE"<<endl;
}
}
779. K-th Symbol in Grammar | 701. Insert into a Binary Search Tree |
429. N-ary Tree Level Order Traversal | 739. Daily Temperatures |
647. Palindromic Substrings | 583. Delete Operation for Two Strings |
518. Coin Change 2 | 516. Longest Palindromic Subsequence |
468. Validate IP Address | 450. Delete Node in a BST |
445. Add Two Numbers II | 442. Find All Duplicates in an Array |
437. Path Sum III | 436. Find Right Interval |
435. Non-overlapping Intervals | 406. Queue Reconstruction by Height |
380. Insert Delete GetRandom O(1) | 332. Reconstruct Itinerary |
368. Largest Divisible Subset | 377. Combination Sum IV |
322. Coin Change | 307. Range Sum Query - Mutable |
287. Find the Duplicate Number | 279. Perfect Squares |
275. H-Index II | 274. H-Index |
260. Single Number III | 240. Search a 2D Matrix II |
238. Product of Array Except Self | 229. Majority Element II |