Mahmoud has n line segments, the i-th of them has length a_{i}. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangle. Mahmoud doesn't accept challenges unless he is sure he can win, so he asked you to tell him if he should accept the challenge. Given the lengths of the line segments, check if he can choose exactly 3 of them to form a non-degenerate triangle.

Mahmoud should use exactly 3 line segments, he can't concatenate two line segments or change any length. A non-degenerate triangle is a triangle with positive area.


-----Input-----

The first line contains single integer n (3 ≤ n ≤ 10^5) — the number of line segments Mahmoud has.

The second line contains n integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^9) — the lengths of line segments Mahmoud has.


-----Output-----

In the only line print "YES" if he can choose exactly three line segments and form a non-degenerate triangle with them, and "NO" otherwise.


-----Examples-----
Input
5
1 5 3 2 4

Output
YES

Input
3
4 1 2

Output
NO



-----Note-----

For the first example, he can use line segments with lengths 2, 4 and 5 to form a non-degenerate triangle.

Difficulty: EASY
Tags: Constructive algorithms

Geometry

Sorting

Greedy algorithms

Number theory

Mathematics
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
n = int(input())
x = [int(w) for w in input().split()]
y = sorted(x)
ans = 'NO'
for i in range(n - 2):
	if y[i] + y[i + 1] > y[i + 2]:
		ans = 'YES'
		break
print(ans)


n = input()
n = int(n)
x = [int(i) for i in input().split()]
t = False
x.sort()
i = n - 1
while i >= 2:
	if x[i] + x[i - 1] > x[i - 2] and x[i] + x[i - 2] > x[i - 1] and (x[i - 1] + x[i - 2] > x[i]):
		t = True
		break
	i -= 1
if t == True:
	print('YES')
else:
	print('NO')


def f():
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	for i in range(2, n):
		if arr[i] < arr[i - 1] + arr[i - 2]:
			print('YES')
			return
	print('NO')
f()


n = int(input())
a = sorted(map(int, input().split()))
b = False
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		b = True
		break
if b:
	print('YES')
else:
	print('NO')


n = int(input())
a = sorted(list(map(int, input().split())))
i = 0
b = False
while i < n - 2:
	if a[i] + a[i + 1] > a[i + 2]:
		b = True
		break
	i += 1
print(('NO', 'YES')[b])


n = int(input())
tmp = input().split()
arr = []
for i in tmp:
	arr.append(int(i))
arr.sort()
f = 0
for i in range(2, n, 1):
	if arr[i] < arr[i - 1] + arr[i - 2]:
		f = 1
		break
if f:
	print('YES')
else:
	print('NO')


from itertools import combinations

def can_triangle(a, b, c):
	if a + b > c and b + c > a and (c + a > b):
		return True
	return False
n = int(input())
li = input().split()
li = [int(i) for i in li]
li.sort()
for i in range(len(li) - 2):
	if can_triangle(li[i], li[i + 1], li[i + 2]):
		print('YES')
		exit(0)
print('NO')


x = int(input())
ar = list(map(int, input().split()))[:x]
ar.sort()
k = 0
for i in range(0, x - 2):
	if ar[i] + ar[i + 1] > ar[i + 2]:
		k = k + 1
if k > 0:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = 0
y = False
while i < n - 2:
	if a[i] + a[i + 1] > a[i + 2]:
		y = True
		break
	i += 1
if y:
	print('YES')
else:
	print('NO')


n = int(input())
num_list = list(map(int, input().split()))
flag = False
if n < 3:
	print('NO')
else:
	num_list.sort()
	for i in range(n - 2):
		if num_list[i] + num_list[i + 1] > num_list[i + 2]:
			print('YES')
			flag = True
			break
	if flag == False:
		print('NO')


def checker(l, length):
	for i in range(length - 2):
		for j in range(i + 1, length - 1):
			if l[i] - l[j] < l[j + 1]:
				return 'YES'
	return 'NO'
length = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
print(checker(l, length))


n = int(input())
a = list(map(int, input().split()))
a.sort()
ok = False
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		ok = True
print(('NO', 'YES')[ok])


n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(0, n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		exit()
print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		print('YES')
		break
else:
	print('NO')


n = int(input())
te = input().split()
A = []
for i in range(len(te)):
	A.append(int(te[i]))
A.sort()
flag = False
for i in range(2, n):
	s = (A[i - 2] + A[i - 1] + A[i]) / 2
	if s > A[i - 1] and s > A[i - 2] and (s > A[i]):
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	for i in range(1, n - 1):
		if arr[i - 1] + arr[i] > arr[i + 1]:
			print('YES')
			return
	print('NO')
	return
t = 1
for _ in range(t):
	main()


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
val = l[0] + l[1]
flag = 0
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		flag = 1
		break
print('YES' if flag == 1 else 'NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import ceil, floor, sqrt, log2, gcd
from heapq import heappush, heappop
from bisect import bisect
import sys
abc = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
arr = list(map(int, input().split()))
mini = float('inf')
arr.sort()
flag = 0
for i in range(1, n - 1):
	if arr[i - 1] + arr[i] > arr[i + 1]:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


def check(arr, n):
	if n < 3:
		return False
	arr.sort()
	for i in range(n - 2):
		if arr[i] + arr[i + 1] > arr[i + 2]:
			return True
n = int(input())
ar = list(map(int, input().split()))
ans = check(ar, n)
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
m = input().split()
m = list(map(int, m))
m.sort()
s = 'NO'
for i in range(len(m) - 2):
	if m[i] + m[i + 1] <= m[i + 2]:
		s = 'NO'
	else:
		s = 'YES'
		break
print(s)


n = int(input())
cisla = list(map(int, input().split()))
cisla.sort()
result = False
for i in range(n - 2):
	if cisla[i] + cisla[i + 1] > cisla[i + 2]:
		print('YES')
		result = True
		break
if not result:
	print('NO')


import sys
n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
for i in range(0, n - 2):
	if i > 30:
		break
	for j in range(i + 1, n - 1):
		if j > 30:
			break
		for k in range(j + 1, n):
			if k > 30:
				break
			if a[i] + a[j] > a[k] and a[i] + a[k] > a[j] and (a[j] + a[k] > a[i]):
				print('YES')
				sys.exit(0)
for t in range(i, n - 2):
	for r in range(t + 1, n - 1):
		for e in range(r + 1, n):
			if a[t] + a[r] > a[e] and a[t] + a[e] > a[r] and (a[e] + a[r] > a[t]):
				print('YES')
				sys.exit(0)
print('NO')


n = int(input())
x = [int(x) for x in input().split()]
x.sort(reverse=True)
for i in range(n):
	for j in range(i + 1, n - 1):
		if x[i] + x[j] > x[j + 1] and x[j] + x[j + 1] > x[i] and (x[i] + x[j + 1] > x[j]):
			print('YES')
			exit()
print('NO')


def solve(a):
	n = len(a)
	a.sort()
	for i in range(n - 2):
		x = a[i]
		y = a[i + 1]
		z = a[i + 2]
		if x + y > z and y + z > x and (z + x > y):
			return True
	return False
n = int(input())
a = [int(i) for i in input().split()]
if solve(a):
	print('YES')
else:
	print('NO')


def checktriangle(a, b, c):
	if a + b > c and a + c > b and (b + c > a):
		return True
	else:
		return False
test_cases = int(input())
a = 2
segments = [int(i) for i in input().split()]
segments.sort()
for i in range(test_cases - 2):
	if checktriangle(segments[i], segments[i + 1], segments[i + 2]):
		print('YES')
		break
else:
	print('NO')


def main():
	n = int(input())
	x = input()
	x = x.split()
	c = 0
	a = []
	while c < n:
		a.append(int(x[c]))
		c += 1
	a.sort()
	i = 0
	ans = 0
	while i <= n - 3:
		if int(a[i]) + int(a[i + 1]) > int(a[i + 2]):
			ans = 1
		i += 1
	if ans:
		print('YES')
	else:
		print('NO')
main()


read = lambda : map(int, input().split())
n = int(input())
a = sorted(read())
for i in range(2, n):
	if a[i - 2] + a[i - 1] > a[i]:
		print('YES')
		break
else:
	print('NO')


t = int(input())
l = list(map(int, input().split()))
l.sort()
n = len(l)
flag = False
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


total = 0
nums = []

def inp():
	global total, nums
	total = int(input())
	nums = input()
	nums = [int(i) for i in nums.split(' ')]

def solve():
	global total, nums
	nums = sorted(nums)
	for i in range(len(nums) - 2):
		if nums[i] + nums[i + 1] > nums[i + 2]:
			return 'YES'
	return 'NO'
inp()
rs = solve()
print(rs)


n = int(input())
l = list(map(int, input().split()))
l.sort()
t = False
for i in range(0, len(l) - 2):
	a = l[i]
	b = l[i + 1]
	c = l[i + 2]
	if a < b + c and b < c + a and (c < a + b):
		print('YES')
		t = True
		break
if t == False:
	print('NO')


v = int(input())
a = list(map(int, input().split()))
a.sort()
flag = 'NO'
for i in range(1, v - 1):
	if a[i - 1] + a[i] > a[i + 1]:
		flag = 'YES'
print(flag)


n = int(input())
A = [int(i) for i in input().split()]
A.sort()
for i in range(n - 2):
	if A[i] + A[i + 1] > A[i + 2]:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
a = 0
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		print('YES')
		a = 1
		break
if a == 0:
	print('NO')


n = int(input())
li = (int(i) for i in input().split())
li = sorted(li)
for i in range(n - 2):
	if li[i] + li[i + 1] > li[i + 2]:
		exit(print('YES'))
print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
ok = False
for i in range(len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2] and a[i + 1] + a[i] > a[i + 2] and (a[i + 2] + a[i] > a[i + 1]):
		ok = True
		break
if ok:
	print('YES')
else:
	print('NO')


from sys import stdin
from collections import defaultdict
input = lambda : stdin.readline().strip()
n = int(input())
lst = list(map(int, input().split()))
lst.sort()
k = 2
nk = 0
while k < n:
	if lst[k - 1] + lst[k - 2] > lst[k]:
		nk = 1
		print('YES')
		break
	k += 1
if nk == 0:
	print('NO')


def mah_triangle():
	res = 'NO'
	segs = []
	n = int(input())
	if n >= 3 and n <= 10 ** 5:
		seg = input().split()
		if n == len(seg):
			for i in range(n):
				if int(seg[i]) >= 1 and int(seg[i]) <= 10 ** 9:
					segs.append(int(seg[i]))
				else:
					return
		segs = sorted(segs)
		for a in range(n - 2):
			b = a + 1
			c = a + 2
			if int(segs[a]) + int(segs[b]) > int(segs[c]) and int(segs[a]) + int(segs[c]) > int(segs[b]) and (int(segs[b]) + int(segs[c]) > int(segs[a])):
				res = 'YES'
	return res
print(mah_triangle())


n = int(input())
L = list(map(int, input().split()))
L.sort()
FLAG = 1
for i in range(n - 2):
	if L[i + 2] < L[i] + L[i + 1] and L[i + 1] + L[i + 2] > L[i] and (L[i + 1] < L[i] + L[i + 2]):
		FLAG = 0
		print('YES')
		break
if FLAG == 1:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
b = 0
for i in range(len(l) - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		print('YES')
		b = 1
		break
if not b:
	print('NO')


import sys

def main(arr):
	arr.sort()
	for i in range(len(arr) - 1, 1, -1):
		(x, y, z) = (arr[i], arr[i - 1], arr[i - 2])
		if y + z > x:
			print('YES')
			return
	print('NO')
mat = []
for (e, line) in enumerate(sys.stdin.readlines()):
	if e == 0:
		continue
	arr = list(map(int, line.strip().split()))
main(arr)


n = int(input())
num = [int(num) for num in input().split(' ')]
assert len(num) == n
num = sorted(num)
ready = False
for i in range(n - 2):
	for j in range(i + 1, n - 1):
		if num[i] + num[j] > num[j + 1]:
			ready = True
			break
	if ready:
		break
if ready:
	print('YES')
else:
	print('NO')


n = int(input())
inp = input().split(' ')
inp = list(map(int, inp))
inp = sorted(inp)
for i in range(n - 1, 1, -1):
	if inp[i] < inp[i - 1] + inp[i - 2]:
		print('YES')
		exit()
print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(1, n - 1):
	if a[i + 1] < a[i] + a[i - 1]:
		print('YES')
		quit()
print('NO')


(n, a) = (int(input()), sorted([int(x) for x in input().split()]))
for x in range(n - 2):
	if a[x] + a[x + 1] > a[x + 2]:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = sorted(map(int, input().split()))
print(('NO', 'YES')[any((x + y > z for (x, y, z) in zip(a, a[1:], a[2:])))])


n = int(input())
data = list(map(int, input().split()))
data.sort()
ans = False
for a in range(n - 2):
	for b in range(a + 1, n - 1):
		ab = data[a] + data[b]
		if ab > data[b + 1]:
			ans = True
			break
	if ans:
		break
if ans:
	print('YES')
else:
	print('NO')


import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def main():
	n = int(input())
	arr = read()
	arr.sort()
	for i in range(n - 2):
		t = arr[i] + arr[i + 1]
		ind = bisect(arr, t - 1) - 1
		if ind > i + 1 and arr[ind] < t:
			print('YES')
			exit()
	print('NO')
main()


n = int(input())
l = list(map(int, input().strip().split()))
l.sort()
v = False
i = n - 1
while True and i >= 2:
	if l[i] < l[i - 1] + l[i - 2]:
		print('YES')
		v = True
		break
	else:
		i -= 1
if v == False:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
r = 0
for i in range(0, len(a) - 2):
	if a[i + 2] < a[i] + a[i + 1]:
		print('YES')
		r = 1
		break
if r == 0:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
final = ''
for i in range(len(arr) - 2):
	if arr[i] < arr[i + 1] + arr[i + 2]:
		final += 'YES'
		break
print('NO') if not final else print(final)


n = int(input())
lengths = map(int, input().split())
t = sorted(lengths)
msg = 'NO'
for i in range(n - 2):
	if t[i] + t[i + 1] > t[i + 2]:
		msg = 'YES'
		break
print(msg)


n = int(input())
lines = []
lines = list(input().split())
for i in range(n):
	lines[i] = int(lines[i])
lines.sort()
answer = 'NO'
for i in range(n - 2):
	if lines[i] + lines[i + 1] > lines[i + 2]:
		answer = 'YES'
print(answer)


def check(a, b, c):
	if a + b > c and b + c > a and (c + a > b):
		return True
	return False
n = int(input())
lis = list(map(int, input().split()))
lis = sorted(lis)[::-1]
(a, b) = (lis[0], lis[1])
flag = 0
for j in range(len(lis) - 2):
	(a, b) = (lis[j], lis[j + 1])
	for i in range(j + 2, len(lis)):
		if check(a, b, lis[i]):
			flag = 1
		if flag == 1:
			break
	if flag == 1:
		break
if flag:
	print('YES')
else:
	print('NO')


from collections import deque

def main():
	from sys import stdin
	lines = deque((line.strip() for line in stdin.readlines()))
	n = int(lines[0])
	nums = sorted((int(x) for x in lines[1].split()))
	for i in range(2, n):
		if nums[i - 2] + nums[i - 1] > nums[i]:
			print('YES')
			return
	print('NO')

def __starting_point():
	main()
__starting_point()


N = int(input())
A = list(map(int, input().split()))
A.sort()
possible = False
for n in range(N - 2):
	if A[n] + A[n + 1] > A[n + 2]:
		possible = True
		break
if possible:
	print('YES')
else:
	print('NO')


n = int(input())
m = sorted(list(map(int, input().split())), reverse=True)
diff = []
for i in range(0, len(m) - 1):
	diff.append(m[i] - m[i + 1])
ans = 'NO'
for i in range(len(diff)):
	if i + 2 < n and m[i + 2] > diff[i]:
		ans = 'YES'
		break
print(ans)


(n, kek) = (int(input()), False)
a = sorted(list(map(int, input().split())))
for i in range(2, n):
	if a[i - 1] + a[i - 2] > a[i]:
		kek = True
print('YES' if kek else 'NO')


n = int(input())
s = list(map(int, input().split()))
s.sort()
flag = 0
for i in range(1, n - 1):
	if s[i - 1] + s[i] > s[i + 1]:
		flag = 1
		print('YES')
		break
if flag == 0:
	print('NO')


n = int(input())
line = [int(it) for it in str(input()).split()]
line.sort()
flag = False
for i in range(n - 2):
	if line[i] + line[i + 1] > line[i + 2]:
		flag = True
		break
print('YES') if flag else print('NO')


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
flag = 0
for i in range(len(lst) - 2):
	if lst[i] + lst[i + 1] > lst[i + 2]:
		print('YES')
		flag = 1
		break
if flag == 0:
	print('NO')


n = int(input())
x = 0
y = 1
z = 2
c = list(map(int, input().split()))
c.sort()
while z <= len(c) - 1:
	if c[x] + c[y] > c[z]:
		print('YES')
		exit(0)
	else:
		x += 1
		y += 1
		z += 1
print('NO')


a = int(input())
l = list()
for x in input().split():
	l.append(int(x))
l.sort()
l.insert(0, 0)
l.insert(0, 0)
flag = 0
for i in range(a):
	if l[i] + l[i + 1] > l[i + 2]:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
segments = sorted([int(x) for x in input().split()])
flag = True
for i in range(n - 2):
	if segments[i] + segments[i + 1] > segments[i + 2]:
		print('YES')
		flag = False
		break
if flag:
	print('NO')


n = int(input())
tamanho = list(map(int, input().split()))
tamanho.sort()
t = False
for i in range(n - 2):
	if tamanho[i] + tamanho[i + 1] > tamanho[i + 2]:
		t = True
if t == True:
	print('YES')
else:
	print('NO')


n = int(input())
l = sorted(list(map(int, input().split())))
flag = 0
for i in range(n - 2):
	if l[i + 2] < l[i] + l[i + 1]:
		flag = 1
		print('YES')
		break
if flag == 0:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = 1
f = 0
while i < n - 1:
	if a[i - 1] + a[i] > a[i + 1]:
		f = 1
		break
	elif a[i - 1] + a[i] <= a[i + 1]:
		i += 1
if f == 1:
	print('YES')
else:
	print('NO')


n = int(input())
sides = list(map(int, input().split()))
sides.sort()
for i in range(n - 2):
	a = sides[i]
	b = sides[i + 1]
	c = sides[i + 2]
	if a + b <= c:
		continue
	else:
		print('YES')
		exit()
print('NO')


def findTriangles(arr):
	num = len(arr)
	arr.sort()
	count = 0
	for i in range(0, num - 2):
		k = i + 2
		for j in range(i + 1, num):
			while k < num and arr[i] + arr[j] > arr[k]:
				k += 1
			count += k - j - 1
		if count > 0:
			return True
	return False
i = int(input())
arr = list(map(int, input().split()))
if findTriangles(arr) == True:
	print('YES')
else:
	print('NO')


def __starting_point():
	(n,) = map(int, input().split())
	a = list(map(int, input().split()))
	res = False
	a.sort()
	for i in range(1, n - 1):
		if a[i - 1] + a[i] > a[i + 1]:
			res = True
			break
	if res:
		print('YES')
	else:
		print('NO')
__starting_point()


number_of_segments = int(input())
segments = list(map(int, input().split()))
segments.sort()
for i in range(2, number_of_segments):
	while i <= number_of_segments:
		if segments[i - 2] + segments[i - 1] > segments[i]:
			print('YES')
			quit()
		else:
			break
print('NO')


n = int(input())
numbers = [int(i) for i in input().split()]
numbers.sort()
for i in range(1, len(numbers) - 1):
	if numbers[i - 1] + numbers[i] > numbers[i + 1]:
		print('YES')
		exit()
print('NO')


l = []
n = int(input())
a = list(map(int, input().split(' ')))
a = sorted(a, reverse=False)
res = False
for i in range(1, n - 1):
	if a[i + 1] < a[i] + a[i - 1]:
		l.append('yes')
		break
if 'yes' in l:
	print('yes')
else:
	print('no')


class CodeforcesTask766BSolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.segments = []

	def read_input(self):
		self.n = int(input())
		self.segments = [int(x) for x in input().split(' ')]

	def process_task(self):
		self.segments.sort()
		can_ = False
		for x in range(self.n - 2):
			if self.segments[x] + self.segments[x + 1] > self.segments[x + 2]:
				can_ = True
				break
		self.result = 'YES' if can_ else 'NO'

	def get_result(self):
		return self.result
Solution = CodeforcesTask766BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = input()
arr = sorted(list(map(int, input().split())))
for i in range(len(arr)):
	try:
		if arr[i] + arr[i + 1] > arr[i + 2]:
			print('YES')
			break
	except IndexError:
		print('NO')
		break
else:
	print('NO')


def isPossible(a):
	n = len(a)
	for i in range(2, n):
		if a[i] < a[i - 1] + a[i - 2]:
			return True
	return False
n = int(input().strip())
a = list(map(int, input().strip().split()))
a = sorted(a)
if isPossible(a):
	print('YES')
else:
	print('NO')


n = int(input())
inp = input()
arr = [int(i) for i in inp.split()]
arr.sort()
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		print('YES')
		exit(0)
print('NO')


size = int(input())
num = input()
lengths = num.split(' ')
for i in range(size):
	lengths[i] = int(lengths[i])
lengths.sort()
found = False
for i in range(size - 2):
	for j in range(i + 1, size - 1):
		if lengths[i] + lengths[j] > lengths[j + 1]:
			print('YES')
			found = True
			break
	if found:
		break
if not found:
	print('NO')


import functools, sys
functools.lru_cache(maxsize=10000)

def Main():
	n = int(input())
	arr = list(map(int, input().split()))
	A = arr
	A.sort()
	for i in range(n):
		for j in range(i + 1, n - 1):
			x = A[i]
			y = A[j]
			z = A[j + 1]
			if x + y > z and x + z > y and (y + z > x):
				print('YES')
				return 0
	print('NO')
Main()


input()
l = sorted([int(i) for i in input().split()])
for i in range(len(l) - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
f = False
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		f = True
		break
if f:
	print('YES')
else:
	print('NO')


n = int(input())
x = list(map(int, input().strip().split(' ')))
x.sort()
try:
	znak = True
	for i in range(len(x)):
		for j in range(i + 1, len(x) - 1):
			if x[i] + x[j] > x[j + 1]:
				print('YES')
				znak = False
				1 / 0
	if znak:
		print('NO')
except:
	pass


nu = int(input())
a = list(map(int, input().split()))
a = sorted(a)
a.reverse()
b = 'NO'
for i in range(nu - 2):
	if a[i] < a[i + 1] + a[i + 2]:
		b = 'YES'
print(b)


n = int(input())
arr = sorted(list(map(int, input().split())))
found = False
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2] and arr[i + 1] + arr[i + 2] > arr[i] and (arr[i] + arr[i + 2] > arr[i + 1]):
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


def isT(s1, s2, s3):
	return s1 + s2 > s3

def hasT(lengths):
	lengths.sort()
	for idx in range(len(lengths) - 2):
		for idx2 in range(idx + 1, len(lengths) - 1):
			if isT(lengths[idx], lengths[idx2], lengths[idx2 + 1]):
				return True
	return False
n = int(input())
lengths = list(map(int, input().split()))
if hasT(lengths):
	print('YES')
else:
	print('NO')


def ehab(L):
	n = len(L)
	for i in range(n - 1, 1, -1):
		if L[i] < L[i - 1] + L[i - 2]:
			return 'YES'
	return 'NO'
n = int(input())
L = list(map(int, input().split()))
L.sort()
print(ehab(L))


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
lengths = sorted(array())
a = lengths[-1]
b = lengths[-2]
c = lengths[-3]
for i in range(1, n - 1):
	a = lengths[i - 1]
	b = lengths[i]
	c = lengths[i + 1]
	if a + b > c and b + c > a and (a + c > b):
		print('YES')
		exit()
print('NO')


t = int(input())
arr = sorted([int(p) for p in input().split()])
for i in range(len(arr) - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		print('YES')
		exit()
print('NO')


numero_linha = int(input())
medidas = list(map(int, input().split(' ')))
medidas.sort(reverse=False)
sim = False
for x in range(len(medidas) - 2):
	if abs(medidas[x] - medidas[x + 1]) < medidas[x + 2] and medidas[x + 2] < medidas[x] + medidas[x + 1]:
		sim = True
		break
if sim is not True:
	print('NO')
elif sim is True:
	print('YES')


def solve():
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ok = False
	for i in range(1, n - 1):
		if a[i] + a[i - 1] > a[i + 1]:
			ok = True
			break
	if ok:
		print('YES\n')
	else:
		print('NO')
solve()


n = int(input())
a = input().split()
a = list(map(int, a))
a.sort()
ans = 'NO'
for i in range(2, n):
	x = a[i - 2]
	y = a[i - 1]
	z = a[i]
	if x + y > z:
		ans = 'YES'
print(ans)


def ok(a, b, c):
	return a + b > c and a + c > b and (b + c > a)
n = int(input())
a = sorted(list(map(int, input().split())))
ye = 0
for i in range(n - 2):
	ye |= ok(a[i], a[i + 1], a[i + 2])
if ye:
	print('YES')
else:
	print('NO')


def hello(n, arr):
	for i in range(n - 2):
		if n < 3:
			print('NO')
		else:
			arr.sort()
			if arr[i] + arr[i + 1] > arr[i + 2]:
				return True
n = int(input())
arr = list(map(int, input().split(' ')))
if hello(n, arr):
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
if len(l) < 3:
	print('NO')
else:
	flag = 0
	l.sort()
	for i in range(n - 2):
		if l[i] + l[i + 1] > l[i + 2]:
			flag = 1
	if flag == 0:
		print('NO')
	else:
		print('YES')


x = int(input())
y = list(map(int, input().split()))
y.sort()
k = 0
for i in range(x - 2):
	if y[i] + y[i + 1] <= y[i + 2]:
		continue
	else:
		print('YES')
		k = 1
		break
if k == 0:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
f = 1
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		print('YES')
		f = 0
		break
if f == 1:
	print('NO')


x = int(input())
a = list(map(int, input().split()))
a.sort()
lol = []
f = 1
for i in range(x - 2):
	lol.append(a[i] + a[i + 1])
for i in range(len(lol)):
	if a[i + 2] < lol[i]:
		f = 0
if f == 0:
	print('YES')
else:
	print('NO')


import sys
z = int(input())
x = list(map(int, input().split()))
x.sort()
for i in range(z - 2):
	if x[i] + x[i + 1] > x[i + 2] and x[i] + x[i + 2] > x[i + 1] and (x[i + 1] + x[i + 2] > x[i]):
		print('YES')
		sys.exit(0)
print('NO')


def main():
	n = int(input())
	lens = [int(i) for i in input().split()]
	lens.sort()
	for i in range(0, n - 2):
		(a, b, c) = (lens[i], lens[i + 1], lens[i + 2])
		if a + b > c:
			print('YES')
			return
	print('NO')
main()


segmentos = int(input())
comprimentos = [int(x) for x in input().split()]
comprimentos.sort()
boolean = False
for i in range(len(comprimentos)):
	if i + 2 <= len(comprimentos) - 1:
		if comprimentos[i] + comprimentos[i + 1] > comprimentos[i + 2]:
			boolean = True
			break
if boolean:
	print('YES')
else:
	print('NO')


n = int(input())
ls = list(map(int, input().split()))
ls.sort()
flag = 0
while n >= 3:
	for i in range(n - 2):
		if ls[i] + ls[n - 2] > ls[n - 1]:
			flag = 1
			break
	if flag == 1:
		break
	else:
		ls.remove(ls[n - 1])
		n = n - 1
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = 0
for i in range(n - 3, -1, -1):
	(a1, b, c) = (a[i], a[i + 1], a[i + 2])
	if a1 < b + c and b < a1 + c and (c < a1 + b):
		print('YES')
		flag = 1
		break
if flag != 1:
	print('NO')


import math, sys, itertools

def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 2):
		if a[i] + a[i + 1] > a[i + 2]:
			print('YES')
			return
	print('NO')

def __starting_point():
	main()
__starting_point()


import sys, math, string, bisect
input = sys.stdin.readline
from collections import deque
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
n = int(input())
l = L()
l.sort(reverse=True)
for i in range(n - 2):
	if l[i] < l[i + 1] + l[i + 2] and l[i + 1] + l[i] > l[i + 2] and (l[i] + l[i + 2] > l[i + 1]):
		print('YES')
		exit()
print('NO')


def check(a, b, c):
	if a <= 0 or b <= 0 or c <= 0:
		return False
	if a + b >= c and a + c >= b and (c + b >= a):
		return True
	else:
		return False

def solved(n, arr):
	arr.sort()
	m = 0
	for i in range(n - 2):
		if arr[i] + arr[i + 1] > arr[i + 2]:
			return True
	return False
n = int(input())
arr = list(map(int, input().split()))
if solved(n=n, arr=arr):
	print('YES')
else:
	print('NO')


n = int(input())
numbers = list(map(int, input().split()))
numbers = sorted(numbers, reverse=True)
found = False
for i in range(n):
	if i + 2 < n:
		if numbers[i] + numbers[i + 1] > numbers[i + 2]:
			if numbers[i] + numbers[i + 2] > numbers[i + 1]:
				if numbers[i + 1] + numbers[i + 2] > numbers[i]:
					found = True
if found:
	print('YES')
else:
	print('NO')


n = int(input())
segments = [int(x) for x in input().split()]
if n > 50:
	print('YES')
else:
	segments = sorted(segments, reverse=True)
	for i in range(n - 2):
		if segments[i] < segments[i + 1] + segments[i + 2]:
			print('YES')
			exit()
	print('NO')


import math
n = int(input())
list = [int(i) for i in input().split()]
list.sort()
for i in range(n - 2):
	if list[i] + list[i + 1] > list[i + 2]:
		print('YES')
		exit()
print('NO')


count = int(input())
line = input()
a = []
for num in line.split():
	a.append(int(num))
a.sort()
found = False
while len(a) > 2:
	longest = a[len(a) - 1]
	second_longest = a[len(a) - 2]
	third_longest = a[len(a) - 3]
	if second_longest + third_longest > longest:
		found = True
		break
	else:
		del a[-1]
if found == True:
	print('YES')
else:
	print('NO')


n = int(input())
m = []
m = input().split()
for i in range(n):
	m[i] = int(m[i])
m.sort()
flag = False
for i in range(len(m) - 2):
	if int(m[i]) + int(m[i + 1]) > int(m[i + 2]):
		flag = True
		break
if flag == True:
	print('YES')
else:
	print('NO')


n = int(input())
s = sorted(map(int, input().split()))[::-1]
for x in range(n - 2):
	t = s[x:x + 3]
	if t[0] + t[1] > t[2]:
		if t[1] + t[2] > t[0]:
			if t[0] + t[2] > t[1]:
				print('YES')
				break
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
for i in range(1, n - 1):
	if a[i - 1] + a[i] > a[i + 1]:
		print('YES')
		break
else:
	print('NO')


n = int(input())
lis = [int(y) for y in input().split()]
lis.sort()
check = 0
for i in range(n - 1, 0, -1):
	left = 0
	right = i - 1
	while left < right:
		if lis[left] + lis[right] > lis[i]:
			check = 1
			break
		else:
			left += 1
	if check:
		break
if check:
	print('YES')
else:
	print('NO')


t = int(input())
b = [int(s) for s in input().split()]
b.sort()
f = 'NO'
for i in range(2, len(b)):
	if b[i - 2] + b[i - 1] > b[i]:
		f = 'YES'
		break
print(f)


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
flag = 0
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
n = I()
a = L()
a.sort()
print(['NO', 'YES'][any((a[i + 2] < a[i + 1] + a[i] for i in range(n - 2)))])


n = int(input())
l = list(map(int, input().split()))
l.sort()
flag = 0
for i in range(1, n - 1, 1):
	if l[i - 1] + l[i] > l[i + 1]:
		flag = 1
		print('Yes')
		break
if flag == 0:
	print('No')


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in range(0, n - 2):
	if l[i] + l[i + 1] > l[i + 2] and l[i + 1] + l[i + 2] > l[i] and (l[i] + l[i + 2] > l[i + 1]):
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
i = n - 3
while i >= 0 and l[i] + l[i + 1] <= l[i + 2]:
	i -= 1
if i >= 0:
	print('YES')
else:
	print('NO')


n = int(input())
sides = list(map(int, input().split()))
sides = sorted(sides, reverse=True)
flag = False
for i in range(n - 2):
	if sides[i] < sides[i + 1] + sides[i + 2] and sides[i + 1] < sides[i] + sides[i + 2] and (sides[i + 2] < sides[i] + sides[i + 1]):
		print('YES')
		flag = True
		break
if not flag:
	print('NO')


def isTriangle(a, b, c):
	if a + b > c and a + c > b and (b + c > a):
		return True
	return False
arr = []
tam = int(input())
arr = list(map(int, input().split()))
arr.sort()
can = False
for i in range(len(arr) - 1, 1, -1):
	if isTriangle(arr[i], arr[i - 1], arr[i - 2]):
		can = True
if can == True:
	print('YES')
else:
	print('NO')


def single_integer():
	return int(input())

def multi_integer():
	return map(int, input().split())

def string():
	return input()

def multi_string():
	return input().split()
n = single_integer()
lines = list(multi_integer())
lines.sort()
ans = False
i = 0
j = n - 2
k = n - 1
for i in range(n - 2):
	if lines[i] + lines[i + 1] > lines[i + 2]:
		print('YES')
		break
else:
	print('NO')


a = int(input())
l = [int(x) for x in input().split()]
l.sort()
for i in range(len(l) - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		if 0.5 * l[i] * l[i + 1] > 0 or 0.5 * l[i + 1] * l[i + 2] > 0 or 0.5 * l[i] * l[i + 2] > 0:
			print('YES')
			exit(0)
		else:
			continue
print('NO')


n = int(input())
numbers = list(map(int, input().split()))
numbers.sort()
ans = 'NO'
for i in range(1, n - 1):
	if numbers[i - 1] + numbers[i] > numbers[i + 1]:
		ans = 'YES'
print(ans)


def middle(n_list):
	n_list.sort()
	for i in range(len(n_list) - 2):
		if n_list[i] + n_list[i + 1] > n_list[i + 2]:
			return True
num = int(input())
num_list_temp = input().split()
num_list = []
for i in num_list_temp:
	num_list.append(int(i))
crit = False
crit = middle(num_list)
if crit == True:
	print('YES')
else:
	print('NO')


n = int(input())
array = sorted(list(map(int, input().split())))

def solve():
	for i in range(n - 1):
		for j in range(n - 1):
			if i >= j:
				continue
			if array[i] + array[j] > array[j + 1]:
				return True
	return False
if solve():
	print('YES')
else:
	print('NO')


n = int(input())
s = sorted(list(map(int, input().split())))
for x in range(n - 2):
	if s[-1 - x] < s[-2 - x] + s[-3 - x]:
		print('Yes')
		break
else:
	print('No')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	works = False
	for i in range(2, n):
		if a[i - 2] + a[i - 1] > a[i]:
			works = True
			break
	print('YES' if works else 'NO')
main()


n = int(input())
a = sorted(list(map(int, input().split())))
a.reverse()
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2] and a[i] + a[i + 2] > a[i + 1] and (a[i + 1] + a[i + 2] > a[i]):
		print('YES')
		break
else:
	print('NO')


from sys import stdin
n = int(input())
arr = list(map(int, stdin.readline().rstrip().split(' ')))
arr.sort()
r = 'NO'
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		r = 'YES'
		break
print(r)


a = int(input())
b = list(map(int, input().split()))
b.sort()
for i in range(0, a - 2):
	if b[i] + b[i + 1] > b[i + 2]:
		print('Yes')
		break
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
a.sort()
sol = 'NO'
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		sol = 'YES'
		break
print(sol)


n = int(input())
h = list(map(int, input().split()))
ans = False
h.sort()
for i in range(len(h)):
	if i > 0 and i < len(h) - 1:
		if h[i + 1] < h[i] + h[i - 1]:
			ans = True
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
numeros = input().split(' ')
numeros = [int(i) for i in numeros]
numeros.sort(reverse=True)
i = 0
se_pudo = False
while i < n - 2:
	if numeros[i] < numeros[i + 1] + numeros[i + 2]:
		print('YES')
		se_pudo = True
		break
	i += 1
if not se_pudo:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
if len(a) < 3:
	print('NO')
	exit()
n = len(a)
for i in range(2, n):
	if a[i] < a[i - 1] + a[i - 2]:
		print('YES')
		exit()
print('NO')


input()
la = list(map(int, input().split()))
la.sort()
f = 0
i = 0
while i < len(la) - 2:
	if la[i] + la[i + 1] > la[i + 2]:
		print('YES')
		f = 1
		break
	else:
		i += 1
if not f:
	print('NO')


ok = False
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
for i in range(2, n):
	s = (arr[i - 2] + arr[i - 1] + arr[i]) / 2
	if arr[i] < s:
		ok = True
		break
if ok == True:
	print('YES')
else:
	print('NO')


__author__ = 'Alexander'

def Test(a, b):
	n = int(a)
	a = [int(elem) for elem in b.split()]
	a = sorted(a, reverse=True)
	output = 'NO'
	while len(a) >= 3:
		a1 = a[0]
		a2 = a[1]
		a3 = a[2]
		if a1 < a2 + a3:
			output = 'YES'
			return output
		else:
			a = a[1:]
	return output

def Main():
	n = input()
	a = input()
	output = Test(n, a)
	print(output)
Main()


def yesno(num, entrada):
	if len(entrada) < 2:
		return 'NO'
	medidas = [int(valor) for valor in entrada]
	medidas.sort(reverse=True)
	for i in range(len(medidas) - 2):
		if medidas[i] < medidas[i + 1] + medidas[i + 2]:
			return 'Yes'
		else:
			continue
	return 'NO'
num = int(input())
entrada = str(input()).split()
print(yesno(num, entrada))


(n, a) = (int(input()), sorted(list(map(int, input().split()))))
print(('NO', 'YES')[any((a[i] + a[i + 1] > a[i + 2] for i in range(n - 2)))])


n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = 0
for i in range(2, n):
	if a[i] + a[i - 1] > a[i - 2] and a[i - 1] + a[i - 2] > a[i] and (a[i - 2] + a[i] > a[i - 1]):
		flag = 1
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in range(n - 2):
	for j in range(i + 1, n - 1):
		if a[j] + a[j + 1] > a[i] and a[i] + a[j] > a[j + 1] and (a[j + 1] + a[i] > a[j]):
			exit(print('YES'))
print('NO')


import math

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
A = inlist()
res = 'NO'
A = sorted(A)
for i in range(n - 2):
	a = A[i]
	b = A[i + 1]
	c = A[i + 2]
	if a + b > c:
		res = 'YES'
		break
print(res)


from sys import stdin, stdout
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
arr.sort()
flag = False
for i in range(n - 2):
	(a, b, c) = (arr[i], arr[i + 1], arr[i + 2])
	if a + b > c and a + c > b and (b + c > a):
		print('YES')
		flag = True
		break
if not flag:
	print('NO')


n = int(input())
listnum = [int(x) for x in input().split()]
listnum.sort()
ok = True
for x in range(n - 2):
	if int(listnum[x]) + int(listnum[x + 1]) > int(listnum[x + 2]) and int(listnum[x + 1]) + int(listnum[x + 2]) > int(listnum[x]) and (int(listnum[x]) + int(listnum[x + 2]) > int(listnum[x + 1])):
		print('YES')
		ok = False
		break
if ok == True:
	print('NO')


def inp():
	return map(int, input().split(' '))

def is_tr(a, b, c):
	if a < b + c:
		if b < a + c:
			if c < b + a:
				return True
	return False
n = int(input())
a = list(inp())
a.sort()
for i in range(n - 2):
	if is_tr(a[i], a[i + 1], a[i + 2]):
		print('YES')
		return
print('NO')


n = int(input())
vals = list(map(int, input().split()))
vals.sort()
i = 1
while i < n - 1:
	if vals[i - 1] + vals[i] > vals[i + 1]:
		print('YES')
		exit(0)
	i += 1
print('NO')


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
flag = False
for i in range(2, n):
	if a[i - 2] + a[i - 1] > a[i]:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


def maket(l):
	l.sort()
	for i in range(len(l) - 2):
		if l[i] + l[i + 1] > l[i + 2]:
			return 'YES'
	return 'NO'
_ = input()
l = list(map(int, input().split()))
print(maket(l))


import sys

class Solver(object):

	def run(self):
		input()
		lines = [int(i) for i in input().split(' ')]
		if len(lines) > 3000:
			print('YES')
			return
		for i in range(len(lines)):
			for j in range(i + 1, len(lines)):
				for k in range(j + 1, len(lines)):
					m = max(max(lines[i], lines[j]), lines[k])
					if lines[i] + lines[j] + lines[k] > m * 2:
						print('YES')
						return
		print('NO')
Solver().run()


n = int(input())
a = list(map(int, input().split()))
a.sort()
found = False
for i in range(1, len(a) - 1):
	if a[i - 1] + a[i] > a[i + 1]:
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, key=int)
for i in range(n - 2):
	cmd = 0
	if a[i] + a[i + 1] > a[i + 2]:
		cmd = 1
		break
	else:
		cmd = 0
print('YES' if cmd == 1 else 'NO')


n = int(input())
x = input()
xx = x.split(' ')
l = []
for i in xx:
	l.append(int(i))
l = sorted(l)
flag = False
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
lens = read_int()
size = sorted(read_ints())
ans = 'NO'
for i in range(lens - 2):
	if size[i] + size[i + 1] > size[i + 2]:
		ans = 'YES'
		break
print(ans)


n = int(input())
a = [*map(int, input().split())]
a.sort()
for i in range(1, n - 1):
	j = i - 1
	k = i + 1
	if a[i] + a[j] > a[k] and a[j] + a[k] > a[i] and (a[i] + a[k] > a[j]):
		print('YES')
		exit()
print('NO')


n = int(input())
a = [int(el) for el in input().split()]
a.sort()
for i in range(n - 2):
	(b, c, d) = (a[i], a[i + 1], a[i + 2])
	if b + c > d:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()

def check(arr):
	return 2 * max(arr) < sum(arr)
for i in range(len(a) - 2):
	t = a[i:i + 3]
	if check(t):
		print('YES')
		exit()
print('NO')


N = int(input())
arr = list(map(int, input().split()))
arr.sort()
flag = False
for i in range(1, len(arr) - 1):
	if arr[i - 1] + arr[i] > arr[i + 1]:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


import itertools
import sys
n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
f = 0
arr.sort()
for i in range(len(arr) - 2):
	if arr[i] + arr[i + 1] > arr[i + 2] and arr[i] + arr[i + 2] > arr[i + 1] and (arr[i + 2] + arr[i + 1] > arr[i]):
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


n = int(input())
inp = input()
a = [int(x) for x in inp.split()]
a.sort()
for i in range(len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		quit()
print('NO')


def non_degenerate(n, a):
	a = sorted(a)
	for x in range(n - 1, 1, -1):
		l = a[x]
		if a[x - 1] + a[x - 2] > a[x]:
			return 'YES'
	return 'NO'
n = int(input())
a = list(map(int, input().split()))
print(non_degenerate(n, a))


n = int(input())
string = input().split()
num = []
for i in string:
	num.append(int(i))
num.sort()
check = False
for i in range(n - 2):
	if num[i] + num[i + 1] > num[i + 2] and num[i] + num[i + 2] > num[i + 1] and (num[i + 1] + num[i + 2] > num[i]):
		print('YES')
		check = True
		break
if check == False:
	print('NO')


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
is_possible = 'NO'
for i in range(n - 1, 1, -1):
	a = arr[i - 2]
	b = arr[i - 1]
	c = arr[i]
	if a + b > c:
		is_possible = 'YES'
		break
print(is_possible)


n = int(input())
a = list(map(int, input().split()))
a.sort()
valid = 0
for i in range(n - 2):
	for j in range(i + 1, n - 1):
		if a[i] > a[j + 1] - a[j]:
			valid = 1
			break
if valid:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
for x in range(n - 2):
	if l[x] + l[x + 1] > l[x + 2]:
		print('YES')
		exit()
print('NO')


quant = int(input())
n = input().split()
contadora = quant - 1
g = 0
diferenca = 0
for x in range(quant):
	n[x] = int(n[x])
n = sorted(n)
while contadora > 0:
	n1 = n[contadora - 1]
	n2 = n[contadora]
	diferenca = n2 - n1
	for x in range(0, contadora):
		if x != contadora and x != contadora - 1:
			if n[x] > diferenca:
				print('YES')
				g = 1
				break
	if g == 1:
		break
	contadora = contadora - 1
if g == 0:
	print('NO')


n = int(input())
List = list(map(int, input().split()))
List.sort()
for i in range(len(List) - 2):
	if List[i] + List[i + 1] > List[i + 2]:
		print('YES')
		exit()
print('NO')


number_of_lines = int(input())
lenghts = [int(x) for x in input().split()]
lenghts.sort()
fail = True
for i in range(2, len(lenghts)):
	if lenghts[i] < lenghts[i - 1] + lenghts[i - 2]:
		print('YES')
		fail = False
		break
if fail:
	print('NO')


n = int(input())
lns = list(map(int, input().split()))
lns.sort(reverse=True)
out = 'NO'
for i in range(2, len(lns)):
	if lns[i] + lns[i - 1] > lns[i - 2] and lns[i] + lns[i - 2] > lns[i - 1] and (lns[i - 1] + lns[i - 2] > lns[i]):
		out = 'YES'
		break
print(out)


n = int(input())
a = sorted(list(map(int, input().split(' '))))
ans = 'NO'
for i in range(0, n - 2):
	if a[i + 2] < a[i + 1] + a[i]:
		ans = 'YES'
print(ans)


n = int(input().strip())
ar = list(map(int, input().strip().split(' ')))
ar.sort()
for i in range(n - 2):
	for j in range(i + 1, n - 1):
		if ar[i] + ar[j] > ar[j + 1]:
			print('YES')
			quit(0)
print('NO')


n = int(input())
lst = list(map(int, input().rstrip().split()))
lst.sort()
flag = 0
for i in range(n - 2):
	if lst[i] + lst[i + 1] > lst[i + 2]:
		flag = 1
if flag == 0:
	print('NO')
else:
	print('YES')


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
n = int(z())
arr = szzz()
ans = 0
for i in range(1, n - 1):
	x = arr[i - 1]
	y = arr[i]
	p = arr[i + 1]
	if x < y + p and y < x + p and (p < x + y):
		ans = 1
print('YES' if ans else 'NO')


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort(reverse=True)
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2] and arr[i + 1] + arr[i + 2] > arr[i] and (arr[i] + arr[i + 2] > arr[i + 1]):
		print('YES')
		break
else:
	print('NO')


n = int(input())
L = sorted(list(map(int, input().split())))
while len(L) >= 3:
	if L[-2] + L[-3] > L[-1]:
		print('YES')
		quit()
	else:
		del L[-1]
print('NO')


def check_triangle(l):
	l.sort()
	for i in range(len(l) - 2):
		if l[i] + l[i + 1] > l[i + 2]:
			(a, b, c) = (l[i], l[i + 1], l[i + 2])
			if a + c > b and b + c > a:
				return 'YES'
	return 'NO'
n = input()
lengths = list(map(int, input().split()))
print(check_triangle(lengths))


import sys

def input():
	return sys.stdin.readline().rstrip('\r\n')

def List():
	return list(map(int, input().split()))

def Num():
	return int(input())
n = Num()
a = List()
a.sort()
ok = False

def tri(a, b, c):
	return a + b > c and b + c > a and (c + a > b)
for i in range(n - 2):
	if tri(a[i], a[i + 1], a[i + 2]):
		ok = True
print('YES' if ok else 'NO')


n = int(input())
a = list(map(int, input().split()))
isPossible = False
a.sort()
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		isPossible = True
		break
if isPossible:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
status = False
for i in range(1, n - 1):
	if a[i - 1] + a[i + 1] > a[i] and a[i - 1] + a[i] > a[i + 1]:
		status = True
if status:
	print('YES')
else:
	print('NO')


a = int(input(''))
c = list(map(int, input().split()))
k = len(c) - 1
s = 0
p = sorted(c)
t = 0
while s <= k - 2:
	do = p[s] + p[s + 1]
	if p[s + 2] < do:
		t = t + 1
	s = s + 1
if t > 0:
	print('Yes')
else:
	print('No')


from sys import stdin, stdout
n = int(stdin.readline())
values = sorted(list(map(int, stdin.readline().split())))
for i in range(n - 2):
	if values[-3 - i] + values[-2 - i] > values[-1 - i]:
		stdout.write('YES')
		break
else:
	stdout.write('NO')


n = int(input())

def check(l1, l2, l3):
	return l1 < l2 + l3 and l2 < l1 + l3 and (l3 < l1 + l2)
segments = [int(i) for i in input().split(' ')]
segments.sort()
canForm = False
for i in range(len(segments) - 2):
	if check(segments[i], segments[i + 1], segments[i + 2]):
		canForm = True
		break
result = 'YES' if canForm else 'NO'
print(result)


n = int(input())
tmp = input().split()
nums = list((int(i) for i in tmp))
nums.sort()
if n < 3:
	print('NO')
	exit(0)
ans = False
for i in range(0, len(nums) - 2):
	if nums[i] + nums[i + 1] > nums[i + 2]:
		ans = True
		break
if ans:
	print('YES')
else:
	print('NO')


import math

def get_int_vector():
	return [int(x) for x in input().split()]
n = int(input())
a = get_int_vector()
a.sort()
for i in range(2, n):
	if a[i - 2] + a[i - 1] > a[i]:
		print('YES')
		exit(0)
print('NO')


n = int(input())
v = list(map(int, input().split()))
v.sort(reverse=True)
ok = False
for i in range(n - 2):
	ok |= v[i] + v[i + 1] > v[i + 2] and v[i] + v[i + 2] > v[i + 1] and (v[i + 1] + v[i + 2] > v[i])
print('YES' if ok else 'NO')


def triangleChecker(a, b, c):
	if a + b > c and b + c > a and (a + c > b):
		return 1
	else:
		return 0
a = int(input())
b = input()
b = b.split()
for i in range(len(b)):
	b[i] = int(b[i])
b.sort()
flag = 0
for i in range(0, len(b) - 2):
	if triangleChecker(b[i], b[i + 1], b[i + 2]) == 1:
		print('YES')
		flag = 1
		break
if flag == 0:
	print('NO')


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
ans = False
while ans is False:
	for x in range(1, n - 1):
		if arr[x - 1] + arr[x] > arr[x + 1]:
			ans = True
	break
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
a = sorted(list(map(int, input().split())))
res = 'NO'
for i in range(2, len(a)):
	if a[i] < a[i - 1] + a[i - 2]:
		res = 'YES'
		break
print(res)


def check(c):
	for i in range(len(c) - 2):
		if c[i] + c[i + 1] > c[i + 2]:
			return 'YES'
	return 'NO'
n = int(input())
c = list(map(int, input().split()))
c.sort()
print(check(c))


(N, arr) = (int(input()), [int(x) for x in input().split()])
arr.sort()
for i in range(1, N - 1):
	if arr[i] + arr[i - 1] > arr[i + 1]:
		print('YES')
		break
else:
	print('NO')


import math
n = int(input())
A = sorted([int(x) for x in input().strip().split()])
print_string = 'NO'
for i in range(1, len(A) - 1):
	if A[i - 1] + A[i] > A[i + 1]:
		print_string = 'YES'
		break
print(print_string)


from math import *
n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
flag = False
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2] and arr[i] + arr[i + 2] > arr[i + 1] and (arr[i + 1] + arr[i + 2] > arr[i]):
		flag = True
if flag:
	print('YES')
else:
	print('NO')


n = int(input().strip())
arr = list(map(int, list(input().strip().split(' '))))
arr.sort()
found = False
for i in range(n - 2):
	a = arr[i]
	b = arr[i + 1]
	c = arr[i + 2]
	if a + b > c:
		print('YES')
		found = True
		break
if not found:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
k = 0
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		k = 1
if k == 1:
	print('Yes')
else:
	print('No')


n = int(input())
a = [int(y) for y in input().split()]
a.sort()
found = False
for i in range(n - 2):
	if a[i + 2] < a[i + 1] + a[i]:
		print('YES')
		found = True
		break
if not found:
	print('NO')


n = int(input())
A = input().split()
a = []
ans = False
for i in range(n):
	a.append(int(A[i]))
a.sort()
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		ans = True
		break
if ans:
	print('YES')
else:
	print('NO')


number = input()
number = int(number)
arr = input().split()
arr1 = []
for i in arr:
	arr1.append(int(i))
arr1.sort()
o = int(0)
for i in range(len(arr1) - 2):
	if arr1[i] + arr1[i + 1] > arr1[i + 2]:
		print('YES')
		o = 1
		break
if o == 0:
	print('NO')


from operator import sub
n = int(input())
d = sorted(map(int, input().split()), reverse=True)
for i in range(n - 2):
	if d[i] < d[i + 1] + d[i + 2]:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = [int(j) for j in input().split()]
l.sort()
flag = 0
for i in range(n - 2):
	a = l[i]
	b = l[i + 1]
	c = l[i + 2]
	if a + b > c and a + c > b and (c + b > a):
		flag = 1
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
a.sort()
t = 0
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		t += 1
		break
if t > 0:
	print('YES')
else:
	print('NO')


a = int(input())
numbers = list(map(int, input().split()))
numbers.sort()
boolean = False
for i in range(0, len(numbers) - 2):
	if numbers[i] + numbers[i + 1] > numbers[i + 2]:
		boolean = True
		break
if boolean:
	print('YES')
else:
	print('NO')


n = int(input())
lst = list(map(int, input().split()))
yo = False
lst.sort()
for i in range(n - 2):
	if lst[i] + lst[i + 1] > lst[i + 2]:
		yo = True
if yo:
	print('YES')
else:
	print('NO')


def tri(a, b, c):
	if a + b > c and b + c > a and (c + a > b):
		return True
	return False
n = int(input())
a = list(map(int, input().split()))
a.sort()
f = 0
for i in range(2, n):
	if tri(a[i], a[i - 1], a[i - 2]):
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


n = int(input())
l = [int(i) for i in input().split()]
f = 0
l.sort()
for i in range(1, n - 1):
	if l[i - 1] + l[i] > l[i + 1]:
		f = 1
		break
print('YES' if f else 'NO')


n = int(input())
i = 0
a = [int(x) for x in input().split()]
a.sort()
while 1:
	d = a[i] + a[i + 1]
	for j in range(i + 2, n):
		if a[j] < d:
			print('YES')
			exit()
	i += 1
	if i >= n - 1:
		print('NO')
		exit()


a = int(input())
b = [int(b) for b in input().split()]
c = 0
b.sort()
for i in range(a - 2):
	if b[i] + b[i + 1] > b[i + 2]:
		c += 1
if c > 0:
	print('YES')
else:
	print('NO')


def ok(arr1):
	n = len(arr1)
	arr1.sort()
	for i in range(1, n - 1):
		if arr1[i - 1] + arr1[i] > arr1[i + 1]:
			return True
	return False
n = int(input())
arr1 = list(map(int, input().split()))
if ok(arr1):
	print('YES')
else:
	print('NO')


def mi():
	return map(int, input().split())
n = int(input())
a1 = list(mi())
a1.sort(reverse=True)
for i in range(n - 2):
	(a, b, c) = (a1[i], a1[i + 1], a1[i + 2])
	if a < b + c and b < a + c and (c < a + b):
		print('YES')
		exit(0)
print('NO')


n = int(input())
arr = sorted(list(map(int, input().split())))
(m, t, s) = (max(arr), 0, 0)
for i in range(1, n - 1):
	if arr[i - 1] + arr[i] > arr[i + 1]:
		print('YES')
		break
else:
	print('NO')


N = int(input())
A = list(map(int, input().split()))
A.sort()
for i in range(N - 2):
	if abs(A[i] - A[i + 1]) < A[i + 2] and A[i + 2] < A[i] + A[i + 1]:
		print('YES')
		exit()
print('NO')


x = int(input())
l = sorted(list(map(int, input().split())))
t = 1
while t < x - 1:
	if l[t - 1] + l[t] > l[t + 1]:
		print('YES')
		break
	t += 1
else:
	print('NO')


import sys
n = int(input())
data = [int(x) for x in input().split()]
data.sort()
for i in range(n - 1, 1, -1):
	x = data[i]
	y = data[i - 1]
	z = data[i - 2]
	if y + z > x:
		print('YES')
		sys.exit()
print('NO')


def solve(arr):
	arr.sort()
	for i in range(len(arr) - 2):
		if arr[i] + arr[i + 1] > arr[i + 2]:
			return 'YES'
	return 'NO'
input()
print(solve(list(map(int, input().split()))))


n = int(input())
A = [int(a) for a in input().split()]
A = list(reversed(sorted(A)))
for i in range(n - 2):
	(c, b, a) = A[i:i + 3]
	if a + b > c:
		print('YES')
		break
else:
	print('NO')


def triangle(a, b):
	if a < 3:
		return False
	b.sort()
	for i in range(a - 2):
		if b[i] + b[i + 1] > b[i + 2]:
			return True
a = int(input())
b = list(map(int, input().split()))
if triangle(a, b) == True:
	print('Yes')
else:
	print('No')


import sys

def check_valid_triangle(a, b, c):
	if a + b > c and b + c > a and (c + a > b):
		return True
	return False
n = int(input())
arr = list(map(int, sys.stdin.readline().strip().split()))
arr.sort()
for i in range(len(arr) - 2):
	if check_valid_triangle(arr[i], arr[i + 1], arr[i + 2]):
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = 0
flag = 0
while 1:
	if i == n - 2:
		break
	first = a[i]
	second = a[i + 1]
	for j in range(i + 2, n):
		third = a[j]
		if first + second - third > 0:
			flag = 1
			break
		else:
			continue
	i += 1
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = 0
f = 0
while i <= n - 3:
	p = a[i]
	q = a[i + 1]
	r = a[i + 2]
	if p + q > r and p + r > q and (q + r > p):
		f = 1
		break
	i += 1
if f == 0:
	print('NO')
else:
	print('YES')


import sys
input = sys.stdin.readline

def check_triangle(a, b, c):
	if a + b > c:
		return 'YES'
	return 'NO'

def solve():
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	ans = 'NO'
	for i in range(n - 2):
		if check_triangle(ls[i], ls[i + 1], ls[i + 2]) == 'YES':
			ans = 'YES'
			break
	print(ans)
solve()


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
count = 1
for i in range(n):
	if i == n - 2:
		break
	elif l1[i] < l1[i + 1] + l1[i + 2] and l1[i + 1] < l1[i] + l1[i + 2] and (l1[i + 2] < l1[i + 1] + l1[i]):
		count = 0
		break
if count == 0:
	print('Yes')
elif count == 1:
	print('NO')


from sys import stdin, stdout
from sys import maxsize
input = stdin.readline

def solve():
	pass
test = 1
for t in range(0, test):
	n = int(input().strip())
	a = [int(x) for x in input().strip().split()]
	a.sort()
	flag = False
	for i in range(n - 2):
		if a[i] + a[i + 1] > a[i + 2]:
			flag = True
	if flag:
		print('YES')
	else:
		print('NO')
	ans = solve()


n = int(input())
data = list(map(int, input().split()))
data.sort()

def check(ind):
	return data[ind] + data[ind + 1] > data[ind + 2]
for i in range(n - 2):
	if check(i):
		print('YES')
		exit(0)
print('NO')


N = int(input())
X = sorted(list(map(int, input().split())))
for i in range(N - 2):
	if X[i] + X[i + 1] > X[i + 2]:
		print('YES')
		exit()
print('NO')


a = int(input())
A = sorted(list(map(int, input().split())))
for i in range(a - 2):
	if A[i] + A[i + 1] > A[i + 2]:
		exit(print('YES'))
print('NO')


n = int(input())
a = sorted(list(map(int, input().split()[:n])))
c = 0
for i in range(n - 2):
	p = (a[i] + a[i + 1] + a[i + 2]) / 2
	if p * (p - a[i]) * (p - a[i + 1]) * (p - a[i + 2]) > 0:
		print('YES')
		exit()
print('NO')


def main():
	rd = lambda : list(map(int, input().split()))
	n = int(input())
	arr = rd()
	arr.sort()
	(x, y, z) = [0, 1, 2]
	while z < len(arr):
		if arr[x] + arr[y] > arr[z]:
			print('YES')
			return
		x += 1
		y += 1
		z += 1
	print('NO')
main()


input()
a = sorted(map(int, input().split()))
print(('YES', 'NO')[all((k >= i + j for (i, j, k) in zip(a, a[1:], a[2:])))])


from collections import deque
from collections import Counter
from itertools import permutations
import heapq

def counterExample():
	arr = [1, 3, 4, 1, 2, 1, 1, 3, 4, 3, 5, 1, 2, 5, 3, 4, 5]
	counter = Counter(arr)
	top_three = counter.most_common(3)
	print(top_three)
q = deque()

def main():
	n = int(input())
	numbers = [int(i) for i in input().split()]
	numbers.sort()
	for i in range(2, n):
		if numbers[i] < numbers[i - 1] + numbers[i - 2]:
			print('YES')
			return
	print('NO')
main()


no_of_line_seg = int(input())
line_seg = [int(x) for x in input().split(' ')]
triangle = False
if no_of_line_seg < 3:
	print('NO')
	exit()
line_seg.sort()
for i in range(no_of_line_seg - 2):
	if line_seg[i] + line_seg[i + 1] > line_seg[i + 2]:
		print('YES')
		exit()
print('NO')
exit()


import math

def triangle(x, y, z):
	if x + y > z and y + z > x and (x + z > y):
		return 1
	else:
		return 0
n = int(input())
a = [int(x) for x in input().split(' ')]
a.sort()
flag = 0
for i in range(n - 2):
	x = a[i]
	y = a[i + 1]
	z = a[i + 2]
	if triangle(x, y, z) == 1:
		flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = sorted(list(map(int, input().split())))
lst = zip(a, a[1:], a[2:])
print('YES') if any([x + y > z for (x, y, z) in lst]) else print('NO')


n = int(input())
k = sorted(map(int, input().split()))
for i in range(n - 2):
	if k[i] + k[i + 1] > k[i + 2]:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = [int(item) for item in input().split()]
a = sorted(a, reverse=True)
for i in range(n):
	if i == n - 2:
		print('NO')
		break
	if a[i + 2] + a[i + 1] > a[i]:
		print('YES')
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
i = 0
while not (a[i] < a[i + 1] + a[i + 2] and a[i + 1] < a[i + 0] + a[i + 2] and (a[i + 2] < a[i + 0] + a[i + 1])) and len(a) - i > 3:
	i += 1
if a[i] < a[i + 1] + a[i + 2] and a[i + 1] < a[i + 0] + a[i + 2] and (a[i + 2] < a[i + 0] + a[i + 1]):
	print('YES')
else:
	print('NO')


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import string
n = ii()
l = li()
l.sort()
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		print('YES')
		exit()
print('NO')


import sys
from itertools import combinations

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None

def solve():
	n = int(input())
	if n >= 45:
		print('YES')
		return
	A = [int(i) for i in input().split()]
	for (i, j, k) in combinations(range(n), 3):
		c = max(A[i], A[j], A[k])
		if A[i] + A[j] + A[k] - c > c:
			print('YES')
			break
	else:
		print('NO')
solve()


input()
a = list(map(int, input().split()))
a.sort()
for i in range(len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		return
print('NO')


from sys import stdin, setrecursionlimit
from collections import deque
input = stdin.readline
setrecursionlimit(int(200000.0))

def getstr():
	return input()[:-1]

def getint():
	return int(input())

def getints():
	return list(map(int, input().split()))

def getint1():
	return list(map(lambda x: int(x) - 1, input().split()))
jn = lambda x, l: x.join(map(str, l))
MOD = 10 ** 9 + 7
(y, n) = ('YES', 'NO')

def solve():
	y = int(input())
	x = list(map(int, input().strip().split(' ')))
	x = sorted(x)
	flag = 0
	for i in range(2, y):
		if x[i - 2] + x[i - 1] > x[i]:
			flag = 1
			print('YES')
			break
	if flag == 0:
		print('NO')
solve()


a = int(input())
l = list(map(int, input().split()))
l.sort()
k = 0
for i in range(a - 2):
	if l[i] + l[i + 1] > l[i + 2] and l[i + 2] + l[i + 1] > l[i] and (l[i + 2] + l[i] > l[i + 1]):
		k = 1
		break
if k == 1:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
while len(l) > 2:
	a = l.pop()
	if a + l[-1] > l[-2]:
		print('YES')
		break
else:
	print('NO')


def codeforces():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(1, n - 1):
		if a[i - 1] + a[i] > a[i + 1]:
			return 'YES'
	return 'NO'
print(codeforces())


import sys

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None

def solve():
	n = int(input())
	A = [int(i) for i in input().split()]
	A.sort()
	for i in range(n - 2):
		if A[i] + A[i + 1] > A[i + 2]:
			print('YES')
			return
	else:
		print('NO')
solve()


def solution(n, l):
	k = n - 1
	j = k - 1
	i = j - 1
	l.sort()
	while i >= 0:
		if l[i] + l[j] <= l[k]:
			i -= 1
			j -= 1
			k -= 1
		else:
			return True
	return False
n = int(input())
l = [int(x) for x in input().split(' ')]
print('YES' if solution(n, l) else 'NO')


n = int(input())
f = sorted(list(map(int, input().split())))
t = True
for i in range(n - 2):
	if f[i] + f[i + 1] > f[i + 2]:
		print('YES')
		t = False
		break
if t:
	print('NO')


n = int(input().strip())
ll = list(map(int, input().split()))
ll = sorted(ll)
t = False
for i in range(n - 2):
	if ll[i] + ll[i + 1] > ll[i + 2]:
		t = True
		break
print('YES' if t == True else 'NO')


import sys
import math
import collections
import bisect

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
n = int(input())
l = get_list()
l.sort()
for i in range(0, n - 2):
	if l[i] + l[i + 1] > l[i + 2] and l[i] + l[i + 2] > l[i + 1] and (l[i + 1] + l[i + 2] > l[i]):
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n - 2):
	if a[i] + a[i + 1] <= a[i + 2] or a[i + 1] + a[i + 2] <= a[i] or a[i] + a[i + 2] <= a[i + 1]:
		continue
	else:
		print('YES')
		exit()
print('NO')


n = int(input())
s = list(map(int, input().split()))
s = sorted(s)
s.reverse()
a = 'NO'
for i in range(n - 2):
	if s[i] < s[i + 1] + s[i + 2]:
		a = 'YES'
print(a)


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = 0
r = -1
while i < n - 2:
	if a[i] + a[i + 1] > a[i + 2]:
		r = 1
	i += 1
if r == 1:
	print('YES')
else:
	print('NO')


input()
segments = sorted(map(int, input().split()))
possible = False
for i in range(len(segments) - 2):
	if segments[i] + segments[i + 1] > segments[i + 2]:
		possible = True
		break
print('YES' if possible else 'NO')


def ri():
	return map(int, input().split())
n = int(input())
a = list(ri())
a.sort()
for i in range(len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		exit()
print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
for i in range(n - 2):
	(a, b, c) = (arr[i], arr[i + 1], arr[i + 2])
	if a + b > c:
		print('YES')
		return
print('NO')


n = int(input())
ar = list(map(int, input().split(' ')))
ar.sort()

def perebor(ar):
	for i in range(n - 2):
		if ar[i] + ar[i + 1] > ar[i + 2]:
			print('YES')
			return
	print('NO')
perebor(ar)


n = int(input())
A = list(map(int, input().split()))
A.sort()
for i in range(n - 2):
	(x, y, z) = (A[i], A[i + 1], A[i + 2])
	if z < x + y:
		print('YES')
		exit(0)
print('NO')


n = int(input())
s = sorted(list(map(int, input().split())))
for (i, j, k) in zip(s, s[1:], s[2:]):
	if i + j > k:
		print('YES')
		exit()
print('NO')


n = int(input())
y = [int(y) for y in input().split()]
b = 0
x = y[::-1]
for i in range(n):
	for j in range(1, n):
		if j > i:
			for k in range(2, n):
				if k > j:
					if x[i] + x[j] > x[k] and x[i] + x[k] > x[j] and (x[j] + x[k] > x[i]) or (y[i] + y[j] > y[k] and y[i] + y[k] > y[j] and (y[j] + y[k] > y[i])):
						b += 1
						break
		if b >= 1:
			break
	if b >= 1:
		break
if b >= 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = n - 1
while i - 1 > 0:
	A = a[i]
	B = a[i - 1]
	start = 0
	end = i - 2
	while start <= end:
		mid = start + (end - start) // 2
		C = a[mid]
		if C > A - B:
			print('YES')
			exit(0)
		elif C <= A - B:
			start = mid + 1
	i -= 1
print('NO')


import random

def generator(a):
	for i in range(0, len(a) - 2):
		yield (a[i] - (a[i + 1] + a[i + 2]))
input()
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = generator(a)
if len([i for i in ans if i < 0]) == 0:
	print('NO')
else:
	print('YES')


n = int(input())
ls = list(map(int, input().split()))
ls.sort()
answer = False
for i in range(n - 2):
	c = ls[i + 1] - ls[i]
	d = ls[i + 2] - ls[i + 1]
	if d < ls[i]:
		answer = True
if answer:
	print('YES')
else:
	print('NO')


n = int(input())
v = list(map(int, input().split(' ')))
v.sort()
for i in range(n):
	if v[i] + v[i + 1] > v[i + 2]:
		print('YES')
		break
	elif i + 2 == n - 1:
		print('NO')
		break


n_lines = int(input())
lines = [int(x) for x in input().split()]
lines.sort()
is_triangle = False
for i in range(1, n_lines - 1):
	if lines[i] + lines[i - 1] > lines[i + 1]:
		is_triangle = True
		break
if is_triangle:
	print('YES')
else:
	print('NO')


n = int(input())
sides = sorted([int(i) for i in input().split()])
for i in range(n - 2):
	if sides[i] + sides[i + 1] > sides[i + 2]:
		print('YES')
		exit(0)
print('NO')


import sys
I = sys.stdin.readline
n = int(input())
arr = list(map(int, I().split()))
arr.sort()
for i in range(n - 1, 1, -1):
	if arr[i - 2] + arr[i - 1] > arr[i]:
		print('YES')
		break
else:
	print('NO')


import sys, random
n = int(sys.stdin.readline())
lns = sorted([int(x) for x in sys.stdin.readline().split()])
for a in range(n - 2):
	b = a + 1
	c = b + 1
	if lns[a] + lns[b] > lns[c] and lns[a] + lns[c] > lns[b] and (lns[b] + lns[c] > lns[a]):
		print('YES')
		exit()
print('NO')


n = int(input())
l = sorted(list(map(int, input().rstrip().split())), reverse=True)
c = 0
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2] and l[i + 1] + l[i + 2] > l[i] and (l[i] + l[i + 2] > l[i + 1]):
		c = 1
		print('YES')
		break
if not c:
	print('NO')


n = int(input())
l = sorted([int(x) for x in input().split()])
alpha = 0
for i in range(1, n - 1, 1):
	if l[i - 1] + l[i] > l[i + 1]:
		alpha = 1
		print('YES')
		break
if alpha == 0:
	print('NO')


def lol(a, b, c):
	return a + b > c
a = input()
lst = [int(x) for x in input().split()]
lst.sort()
x = 0
for i in range(len(lst) - 2):
	if lol(lst[i], lst[i + 1], lst[i + 2]):
		x = 1
if x:
	print('YES')
else:
	print('NO')


def is_triangle(a, b, c):
	return a < b + c and b < a + c and (c < a + b)

def solve(s):
	for i in range(len(s) - 2):
		if is_triangle(s[i], s[i + 1], s[i + 2]):
			return 'YES'
	return 'NO'
n = int(input())
sides = list(map(int, input().split()))
sides.sort()
print(solve(sides))


n = int(input())
a = list(map(int, input().split(' ')))
a = sorted(a)
check = 0
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2] and a[i + 2] + a[i + 1] > a[i] and (a[i] + a[i + 2] > a[i + 1]):
		check = 1
		break
print('YES' if check is 1 else 'NO')


N = int(input())
X = sorted(list(map(int, input().split())))
for i in range(N - 2):
	for j in range(i + 1, N - 1):
		for k in range(j + 1, N):
			if X[i] + X[j] > X[k]:
				print('YES')
				exit()
			else:
				break
print('NO')


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def main():
	n = ii()
	a = li()
	a.sort()
	f = 0
	for i in range(n - 2):
		if a[i + 2] < a[i] + a[i + 1]:
			f = 1
	if f == 0:
		print('NO')
	else:
		print('YES')
main()


def isDegenerate(a, b, c):
	return a + b > c and b + c > a and (c + a > b)
n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort()
ans = 'NO'
for i in range(n - 2):
	if isDegenerate(arr[i], arr[i + 1], arr[i + 2]):
		ans = 'YES'
		break
print(ans)


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))

def solve():
	n = int(input())
	a = list(read_tuple(int))
	a.sort()
	i = n - 1
	ans = 'NO'
	while i > 1:
		z = a[i]
		x = a[i - 1]
		y = a[i - 2]
		if x + y > z:
			ans = 'YES'
			break
		i -= 1
	print(ans)
solve()


n = int(input())
a = [int(i) for i in input().split()]

def checktriangle(n, a):
	if n > 50:
		return True
	for i in range(n):
		a = sorted(a)
		for j in range(n - 2):
			if a[j] + a[j + 1] > a[j + 2]:
				return True
	return False
if checktriangle(n, a):
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
flag = False
for k in range(n - 1, 1, -1):
	i = 0
	j = k - 1
	while i < j:
		if a[i] + a[j] > a[k]:
			if a[i] > a[k] - a[j] and a[j] > a[k] - a[i]:
				flag = True
				print('YES')
				break
		else:
			i += 1
	if flag:
		break
else:
	print('NO')


n = int(input())
arr1 = []
play = False
array = input().split()
for i in range(0, n):
	arr1.append(int(array[i]))
arr1.sort()
for j in range(0, n - 2):
	if arr1[j] + arr1[j + 1] > arr1[j + 2]:
		play = True
		break
if play == True:
	print('YES')
else:
	print('NO')


n = int(input())
l1 = list(map(int, input().split()))
a = len(l1)
l1.sort()
i = a - 2
ans = 'NO'
while i >= 0:
	if i == 0:
		break
	m = l1[i + 1]
	ans = bool(l1[i] + l1[i - 1] > m)
	if ans == False:
		ans = 'NO'
	else:
		ans = 'YES'
		break
	i -= 1
print(ans)


def check(x, y, z):
	if x + y > z:
		return True
	return False
n = int(input())
a = [int(a) for a in input().split()]
a.sort()
mark = 0
for i in range(0, n - 2):
	if check(a[i], a[i + 1], a[i + 2]):
		print('YES')
		mark = 1
		break
if mark == 0:
	print('NO')


n = int(input())
A = list(map(int, input().split()))
for i in range(n):
	for j in range(i):
		for k in range(j):
			(a, b, c) = (A[i], A[j], A[k])
			if 2 * max(a, b, c) < a + b + c:
				print('YES')
				exit(0)
print('NO')


n = int(input())
c = 1
x = sorted(list(map(int, input().split(' '))))
for i in range(n - 2):
	if x[i] + x[i + 1] > x[i + 2]:
		c = 0
		print('YES')
		break
if c:
	print('NO')


import os
LOCAL_PC = 'n1amr' in os.path.expanduser('~')

def solve(input, print):
	n = int(input())
	a = [*sorted(map(int, input().split()))]
	ans = sol(a)
	print('YES' if ans else 'NO')

def sol(a):
	for i in range(len(a) - 2):
		if a[i] + a[i + 1] > a[i + 2]:
			return True
	return False

def process_file(in_name, out_name):
	with open(in_name, 'r') as fin:
		with open(out_name, 'w') as fout:

			def read():
				return fin.readline().rstrip('\n')

			def write(*args, end='\n'):
				text = ' '.join(map(str, args)) + end
				fout.write(text)
				print(text, end='')
			t = int(fin.readline())
			for i in range(t):
				read()
				write('Case #{T}: \n'.format(T=i + 1), end='')
				solve(read, write)
				write()

def process_stdio():

	def read():
		return input()

	def write(*args, end='\n'):
		print(*args, end=end)
	solve(read, write)
if LOCAL_PC:
	in_name = __file__[:-3] + '.in'
	out_name = __file__[:-3] + '.out'
	process_file(in_name, out_name)
else:
	process_stdio()


import sys
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		sys.exit()
print('NO')


I = lambda : map(int, input().split())
n = int(input())
a = list(I())
a.sort()
for i in range(len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		exit(print('YES'))
print('NO')


def Tri(t, n):
	t.sort()
	for i in range(n - 2):
		a = t[i]
		b = t[i + 1]
		c = t[i + 2]
		if a + b > c and b + c > a and (c + a > b):
			return 'YES'
	return 'NO'
(n, t) = (int(input()), list(map(int, input().split())))
print(Tri(t, n))


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
s = 0
for i in range(0, n - 2):
	if a[i] < a[i + 1] + a[i + 2] and a[i + 1] < a[i] + a[i + 2] and (a[i + 2] < a[i] + a[i + 1]):
		print('YES')
		s = -1
		break
if s != -1:
	print('NO')


n = input()
a = [int(x) for x in input().split()]
a.sort()
b = a[2:]
(x, y) = (a[0], a[1])
flag = False
for v in b:
	if x + y > v:
		flag = True
	else:
		(x, y) = (y, v)
print('YES' if flag else 'NO')


input()
w1 = sorted([int(x) for x in input().split()])
for i in range(len(w1) - 2):
	(x, y, z) = (w1[i], w1[i + 1], w1[i + 2])
	if x + y > z:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
while n >= 3:
	if a[n - 3] + a[n - 2] > a[n - 1]:
		print('YES')
		break
	n -= 1
if n < 3:
	print('NO')


N = int(input())
ch = input().split()
ch = [int(i) for i in ch]
ch.sort()

def do():
	for i in range(len(ch) - 2):
		if ch[i] + ch[i + 1] > ch[i + 2]:
			print('YES')
			return
	print('NO')
do()


n = int(input())
nums = list(map(int, input().split()))
nums.sort()
flag = False
for i in range(1, len(nums) - 1):
	if nums[i - 1] + nums[i] > nums[i + 1]:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
A = sorted(map(int, input().split()), reverse=True)
for i in range(n - 2):
	if A[i] < A[i + 1] + A[i + 2]:
		print('YES')
		break
else:
	print('NO')


def r():
	return list(map(int, input().split()))
n = int(input())
ss = r()
ss.sort()
for i in range(1, len(ss) - 1):
	if ss[i - 1] + ss[i] > ss[i + 1]:
		print('YES')
		exit()
print('NO')


n = int(input())
l1 = list(map(int, input().split()))
flag = 'NO'
l1.sort()
for i in range(n - 2):
	for j in range(i + 2, n):
		if l1[i] + l1[i + 1] > l1[j]:
			flag = 'YES'
			break
print(flag)


n = int(input())
lst = sorted(list(map(int, input().split())))
if all((lst[i] + lst[i + 1] <= lst[i + 2] for i in range(0, n - 2))):
	print('NO')
else:
	print('YES')


le = int(input())
seq = list(map(int, input().split()))
seq.sort()
res = 'NO'
for i in range(le - 2):
	if seq[i] + seq[i + 1] > seq[i + 2]:
		res = 'YES'
		break
print(res)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
i = len(l) - 1
ok = True
while ok and i > 1:
	if l[i] < l[i - 1] + l[i - 2]:
		ok = False
	else:
		i -= 1
print('NO' if ok else 'YES')


a = input()
z = list(map(int, input().split()))
z = sorted(z)
flag = 0
for i in range(0, len(z) - 2):
	if z[i] + z[i + 1] > z[i + 2]:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


s = int(input())
x = list(map(int, input().split()))
x.sort()
f = 0
for i in range(s - 2):
	if x[i] + x[i + 1] > x[i + 2]:
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


n = int(input())
m = list(map(int, input().split()))
m.sort()
a = False
for i in range(n - 2):
	if m[i] + m[i + 1] > m[i + 2]:
		a = True
		break
if a:
	print('Yes')
else:
	print('No')


n = int(input())
a = input().split(' ')
for i in range(n):
	a[i] = int(a[i])
a = sorted(a)
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		quit()
print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
f = False
for i in range(0, n - 2):
	t = a[i:i + 3]
	if t[0] + t[1] > t[2]:
		print('YES')
		f = True
		break
if not f:
	print('NO')


n = int(input())
nums = list(map(int, input().split()))
nums.sort()
judge = False
for i in range(n - 2):
	if nums[i] + nums[i + 1] > nums[i + 2]:
		judge = True
if judge:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout, maxsize
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
n = I()
ls = lint()
ls.sort()
for i in range(n - 2):
	if ls[i] + ls[i + 1] > ls[i + 2]:
		print('YES')
		exit()
print('NO')


n = int(input())
l = [*map(int, input().split())]
l.sort()
for i in range(n - 2):
	a = l[i]
	b = l[i + 1]
	c = l[i + 2]
	if a + b > c and a + c > b and (b + c > a):
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
nt = True
for i in range(n - 2):
	x = int(l[-(i + 1)])
	y = int(l[-(i + 2)])
	z = int(l[-(i + 3)])
	if x + y > z and x + z > y and (z + y > x):
		print('YES')
		nt = False
		break
if nt:
	print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = sorted(LI())
	for i in range(n - 2):
		(b, c, d) = a[i:i + 3]
		if b + c > d:
			return 'YES'
	return 'NO'
print(main())


n = int(input())
a = list(map(int, input().split()))
b = False
a.sort()
for i in range(1, n - 1):
	if a[i + 1] + a[i - 1] > a[i] and a[i] + a[i - 1] > a[i + 1] and (a[i + 1] + a[i] > a[i - 1]):
		print('YES')
		b = True
		break
if b == False:
	print('NO')


def check(sides, n):
	for i in range(1, n - 1):
		if sides[i - 1] + sides[i] > sides[i + 1]:
			return 'YES'
	return 'NO'
n = int(input())
sides = [int(k) for k in input().split()]
sides.sort()
print(check(sides, n))


def main():
	n = int(input())
	(a, b, *cc) = sorted(map(int, input().split()))
	for c in cc:
		if a + b > c:
			print('YES')
			return
		(a, b) = (b, c)
	print('NO')
main()


import itertools
n = int(input())
s = list(map(int, input().split()))
for t in itertools.permutations(s, 3):
	if len(s) > 1000:
		print('YES')
		exit()
	if t[0] + t[1] > t[2] and t[1] + t[2] > t[0] and (t[0] + t[2] > t[1]):
		print('YES')
		exit()
print('NO')


a = int(input())
b = list(map(int, input().split()))
b.sort()
ans = 'NO'
for i in range(a - 2):
	if b[i] + b[i + 1] > b[i + 2]:
		ans = 'YES'
print(ans)


import sys

def tri(a, b, c):
	if a < b + c and b < a + c and (c < a + b):
		return True
	return False
n = int(input())
li = list(map(int, input().split()))
li.sort()
i = 0
while i < n - 2:
	if tri(li[i], li[i + 1], li[i + 2]):
		print('YES')
		sys.exit()
	i += 1
print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
x = 0
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2] and l[i] + l[i + 2] > l[i + 1] and (l[i + 2] + l[i + 1] > l[i]):
		print('YES')
		x = 1
		break
if x != 1:
	print('NO')


def main():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(1, n - 1):
		if l[i - 1] + l[i] > l[i + 1]:
			print('YES')
			return 1
	print('NO')
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
x = 0
while x <= n - 3:
	if a[x] + a[x + 1] > a[x + 2]:
		print('YES')
		exit(0)
	x += 1
print('NO')


total = int(input())
linha = [int(v) for v in input().split()]
linha.sort()

def testa_existencia(a, b, c):
	if b - c < a < b + c and a - c < b < a + c and (a - b < c < a + b):
		return True
resultado = 'NO'
for i in range(total):
	if i == 0:
		if testa_existencia(linha[i], linha[i + 1], linha[i + 2]) == True:
			resultado = 'YES'
	elif i == total - 1:
		if testa_existencia(linha[total - 1], linha[total - 2], linha[total - 3]) == True:
			resultado = 'YES'
	elif i == 1 or i == total - 2:
		if testa_existencia(linha[i], linha[i - 1], linha[i + 1]) == True:
			resultado = 'YES'
	else:
		if testa_existencia(linha[i], linha[i - 1], linha[i + 1]) == True:
			resultado = 'YES'
		if testa_existencia(linha[total - 1], linha[total - 2], linha[total - 3]) == True:
			resultado = 'YES'
		if testa_existencia(linha[i], linha[i + 1], linha[i + 2]) == True:
			resultado = 'YES'
print(resultado)


n = int(input())
arr = sorted(map(int, input().split()))
t = 0
for i in range(n - 2):
	if arr[i + 2] < arr[i] + arr[i + 1]:
		t = 1
if t == 1:
	print('YES')
else:
	print('NO')


n = int(input())
segments = list(map(int, input().split()))
segments.sort()
(i, j, k) = (0, 1, n - 1)
flag = False
for i in range(1, n - 1):
	if segments[i - 1] + segments[i] > segments[i + 1]:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


import itertools

def triangulable(comb):
	if comb[1] + comb[0] > comb[2]:
		return True
	return False

def decide(l):
	for i in range(len(l) - 2):
		if triangulable(l[i:i + 3]):
			return 'YES'
	return 'NO'
n = int(input())
lengths = sorted(list(map(int, input().split())))
if n < 2:
	print('NO')
else:
	print(decide(lengths))


n = int(input())
array = list(map(int, input().split()))
array.sort()
ans = False
i = n - 1
while i > 1:
	if array[i - 1] + array[i - 2] > array[i]:
		ans = True
		break
	i -= 1
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
assume = False
for x in range(0, n - 2):
	if l[x] + l[x + 1] > l[x + 2]:
		assume = True
if assume:
	print('YES')
else:
	print('NO')


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
l2 = []
for i in range(n - 2):
	for j in range(i + 2, n):
		if l1[i] + l1[i + 1] > l1[j]:
			l2.append('YES')
			break
		else:
			l2.append('NO')
if 'YES' in l2:
	print('YES')
else:
	print('NO')


import heapq
n = int(input())
a = list(map(int, input().split()))
heapq.heapify(a)
e1 = heapq.heappop(a)
e2 = heapq.heappop(a)
while a:
	e3 = heapq.heappop(a)
	if e1 + e2 > e3:
		print('YES')
		break
	else:
		e1 = e2
		e2 = e3
else:
	print('NO')


def main():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	x = 0
	y = 1
	z = 2
	for i in l[z:]:
		con1 = l[y] - l[x]
		con2 = l[y] + l[x]
		if i < con2 and i > con1:
			print('yes')
			break
		else:
			x += 1
			y += 1
			z += 1
	else:
		print('NO')
main()


def main():
	n = int(input())
	a = input().strip().split()
	for (index, item) in enumerate(a):
		a[index] = int(item)
	a.sort()
	for i in range(n - 2):
		if a[i] + a[i + 1] > a[i + 2]:
			print('YES')
			return 0
	print('NO')
main()


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
from math import sqrt
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	n = inin()
	a = ain()
	a.sort()
	for i in range(len(a) - 2):
		if a[i] + a[i + 1] > a[i + 2]:
			print('YES')
			quit()
	print('NO')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
s1 = sum(l1[:3])
for i in range(n - 2):
	if s1 - l1[i] > l1[i] and s1 - l1[i + 2] > l1[i + 2] and (s1 - l1[i + 1] > l1[i + 1]):
		print('YES')
		break
	if i + 3 <= n - 1:
		s1 = s1 - l1[i] + l1[i + 3]
else:
	print('NO')


n = int(input())
A = input().split(' ')
for i in range(0, n):
	A[i] = int(A[i])
A.sort()
ans = 'NO'
for i in range(0, n - 2):
	j = i + 1
	k = j + 1
	if A[i] + A[j] > A[k]:
		ans = 'YES'
print(ans)


n = int(input())
arr = sorted((int(x) for x in input().split()))
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		exit(print('YES'))
print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
(i, j) = (0, 1)
ans = 'NO'
while j < n - 1:
	sm = arr[i] + arr[j]
	if sm > arr[j + 1]:
		ans = 'YES'
		break
	else:
		i += 1
		j += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
t = []
m = 0
for i in range(n - 1):
	for j in range(n - 1):
		if i != j:
			if j > i:
				fst = a[i]
				snd = a[j]
				trd = a[j + 1]
				if fst + snd > trd and fst + trd > snd and (snd + trd > fst):
					print('YES')
					m = 1
					break
				else:
					break
			else:
				fst = a[i]
				snd = a[j]
				trd = a[i + 1]
				if fst + snd > trd and fst + trd > snd and (snd + trd > fst):
					print('YES')
					m = 1
					break
	if m == 1:
		break
if m == 0:
	print('NO')


_ = input()
a = list(map(int, input().split()))
a.sort()
flag = 0
for i in range(len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		flag = 1
		break
if flag == 0:
	print('NO')


a = int(input())
b = sorted(map(int, input().split()))
i = 0
while i <= a - 3:
	if b[i] + b[i + 1] > b[i + 2]:
		exit(print('YES'))
	i += 1
print('NO')


def check(a, b, c):
	if a + b > c and a + c > b and (b + c > a):
		return 'YES'
	else:
		return 'NO'

def mymin(a, b, c):
	return 0

def myf(n, sn):
	sn.sort()
	i = 2
	a = sn[:3]
	for i in range(3, n):
		result = check(a[0], a[1], a[2])
		if result == 'NO':
			a[0] = sn[i]
			a.sort()
		else:
			return 'YES'
	return check(a[0], a[1], a[2])
n = int(input())
sn = list(map(int, input().split()))
res = myf(n, sn)
print(res)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
f = False
for i in range(2, n):
	if arr[i - 2] + arr[i - 1] > arr[i]:
		print('YES')
		f = True
		break
if not f:
	print('NO')


import math
import os
import random
import re
import sys
n = int(input())
a = list(map(int, input().rstrip().split()))
a.sort()
c = 0
for i in range(0, len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		c = 1
		break
if c == 1:
	print('YES')
else:
	print('NO')


import sys
from bisect import bisect_left, bisect_right
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log10
from itertools import permutations
inf = float('inf')
mod = 1000000007
mini = 1000000007

def fact(n):
	if n == 0:
		return 1
	p = 1
	d = 10 ** 9 + 7
	for i in range(1, n + 1):
		p = p * i
		p = p % d
	return p

def ncr(n, r):
	d = 10 ** 9 + 7
	num = fact(n)
	den = fact(r) * fact(n - r) % d
	den = pow(den, d - 2, d)
	return num * den % d

def sieve(n):
	prime = [True for i in range(n + 1)]
	lst = []
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p = p + 1
	for i in range(2, n + 1):
		if prime[i]:
			lst.append(i)
	return lst

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def calculate_factors(n):
	hh = [1] * (n + 1)
	p = 2
	while p * p < n:
		if hh[p] == 1:
			for i in range(p * 2, n, p):
				hh[i] = 0
		p += 1
	total = 1
	for p in range(2, n + 1):
		if hh[p] == 1:
			count = 0
			if n % p == 0:
				while n % p == 0:
					n = int(n / p)
					count += 1
				total *= count + 1
	return total

def prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			factors.add(n // i)
			n = n // i
			factors.add(i)
	if n > 1:
		factors.add(n)
	return factors

def isPrime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n < 2:
		return False
	for i in range(3, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
Arr.sort()
flag = 0
for i in range(n - 2):
	a = Arr[i]
	b = Arr[i + 1]
	c = Arr[i + 2]
	if a + b > c:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


n = int(input())
lst = [int(x) for x in input().split()]
lst.sort()
i = 0
t = False
while not t and i + 1 < len(lst):
	j = 2
	while not t and i + j < len(lst):
		if lst[i + j] < lst[i] + lst[i + 1]:
			t = True
		j += 1
	i += 1
if not t:
	print('NO')
else:
	print('YES')


n = int(input())
l = sorted(list(map(int, input().split())))
i = 2
ans = 'NO'
while i < n:
	if l[i] - l[i - 1] < l[i - 2]:
		ans = 'YES'
	i += 1
print(ans)


import sys
from pprint import pprint

def longest_uncommon(s1, s2):
	if len(s1) > len(s2):
		return longest_uncommon(s2, s1)
	if len(s1) == 0 or len(s1) < len(s2):
		return len(s2)
	if s1 == s2:
		return -1
	else:
		return len(s2)

def choose_iter(elements, length):
	if len(elements) < length:
		return []
	for i in range(len(elements)):
		if length == 1:
			yield (elements[i],)
		else:
			for next in choose_iter(elements[i + 1:], length - 1):
				yield ((elements[i],) + next)

def form_triangle(line_num, a):
	a = sorted(a)
	return 'YES' if [0 for (x, y, z) in zip(a, a[1:], a[2:]) if x + y > z] else 'NO'
line_num = int(input())
line_lengths = [int(s) for s in input().split(' ')]
print(form_triangle(line_num, line_lengths))


n = input()
side = list(map(int, input().split()))
case = False
side.sort(reverse=True)
for i in range(len(side) - 2):
	a = side[i]
	b = side[i + 1]
	c = side[i + 2]
	if b + c > a:
		case = True
		break
if case == True:
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
s = arr[0] + arr[1]
flag = 0
for i in range(2, n):
	val = arr[i]
	if s > val:
		flag = 1
		break
	s -= arr[i - 2]
	s += val
if flag == 0:
	print('NO')
else:
	print('YES')


n = int(input())
ai = list(map(int, input().split()))
ai.sort()
ans = 0
for i in range(2, n):
	temp = max(ai[i - 2:i + 1])
	if temp < sum(ai[i - 2:i + 1]) - temp:
		ans = 1
		break
print('YES' * ans + 'NO' * (1 - ans))


import sys
n = int(input())
arr = sorted(list(map(int, input().split())))
for i in range(n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		print('YES')
		sys.exit()
print('NO')


n = int(input())
nums = [int(s) for s in input().split()]
snums = nums.sort()

def check(a, b, c):
	if a + b > c and a + c > b and (b + c > a):
		return True
	else:
		return False
i = 0
not_found = True
while not_found and i <= n - 3:
	if check(nums[i], nums[i + 1], nums[i + 2]):
		not_found = False
	i += 1
if not_found:
	print('NO')
else:
	print('YES')


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
test = 0
for i in range(len(arr) - 2):
	a = arr[i]
	b = arr[i + 1]
	if a != 0 and b != 0:
		for j in range(len(arr) - 1, i + 1, -1):
			c = arr[j]
			if abs(a - b) < c and c < a + b:
				print('YES')
				test = 1
				break
			if c < a + b:
				break
		if test == 1:
			break
if test == 0:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 'NO'
for i in range(2, n):
	if a[i - 1] + a[i - 2] > a[i]:
		ans = 'YES'
		break
print(ans)


n = int(input())
lst = [int(x) for x in input().split()]
lst.sort()
ok = True
for i in range(len(lst) - 2):
	if lst[i + 2] - lst[i] < lst[i + 1]:
		print('YES')
		ok = False
		break
if ok == True:
	print('NO')


import itertools
n = int(input())
arr = sorted([int(i) for i in input().split()])
for i in range(n - 2):
	if arr[i + 2] < arr[i + 1] + arr[i]:
		print('YES')
		exit(0)
print('NO')


n = int(input())
lines = [int(x) for x in input().split()]
lines.sort()
pair_diff = []
for i in range(n - 2):
	temp = lines[i + 1] - lines[i] + (lines[i + 2] - lines[i + 1])
	pair_diff.append(temp)
found = 0
x = len(pair_diff)
inft = 3000000000
while found == 0 and x > 0:
	val = min(pair_diff)
	pos = pair_diff.index(val)
	if lines[pos] + lines[pos + 1] > lines[pos + 2]:
		found = 1
		break
	else:
		pair_diff[pos] = inft
		x -= 1
if found == 1:
	print('YES')
else:
	print('NO')


cnt = lambda s, i: s.count(i)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
n = ii()
fg = 0
l = sorted(il())[::-1]
for i in range(n - 2):
	if l[i + 1] + l[i + 2] > l[i]:
		fg = 1
print('YNEOS'[fg == 0::2])


n = int(input())
lengths = list(map(int, input().split()))
lengths.sort()

def isTriangle(twoMFs, long):
	if long < twoMFs:
		return True
	else:
		return False
canDo = False
for lol in range(0, n - 2):
	if isTriangle(lengths[lol] + lengths[lol + 1], lengths[lol + 2]):
		canDo = True
		break
if canDo:
	print('YES')
else:
	print('NO')


n = int(input())
l = sorted(map(int, input().split()))
for i in range(n):
	if l[n - i - 1] + l[n - i - 2] > l[n - i - 3] and l[n - i - 3] + l[n - i - 2] > l[n - i - 1] and (l[n - i - 1] + l[n - i - 3] > l[n - i - 2]):
		print('YES')
		n = 0
		break
if n != 0:
	print('NO')


w = int(input())
d = [int(x) for x in input().split(' ')]
d.sort()
cond = False
while len(d) >= 3:
	c = d[-3:]
	if sum(c[:-1]) <= c[-1]:
		d.pop()
	else:
		cond = True
		break
if cond:
	print('YES')
else:
	print('NO')


n = [int(d) for d in input().split(' ')]
a = sorted([int(c) for c in input().split(' ')], reverse=True)
f = False
for i in range(len(a) - 2):
	if a[i] + a[i + 1] > a[i + 2] and a[i] + a[i + 2] > a[i + 1] and (a[i + 1] + a[i + 2] > a[i]):
		print('YES')
		f = True
		break
if not f:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a, reverse=True)
new = []
diff = 1000000000
finish = False
for i in range(2, len(a)):
	if a[i] + a[i - 1] > a[i - 2]:
		print('YES')
		finish = True
		break
if not finish:
	print('NO')


n = input()
segments = input()
segments = segments.split()
segments = [int(x) for x in segments]
segments.sort()

def finder(lista):
	a = False
	for h in reversed(range(2, len(lista))):
		if a:
			break
		for c in range(1, len(lista) - 1):
			if lista[h] < lista[h - c] + lista[h - (c + 1)]:
				print('YES')
				a = True
				break
			else:
				break
	if not a:
		print('NO')
finder(segments)


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
for i in range(2, n):
	if a[i - 2] < a[i - 1] + a[i]:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
for i in range(n - 2):
	for j in range(i + 1, n - 1):
		for k in range(j + 1, n):
			if a[i] + a[j] > a[k] and a[i] + a[k] > a[j]:
				print('YES')
				exit()
			else:
				break
print('NO')


n = int(input())
sides = sorted(list(map(int, input().split())))
b = False
for i in range(n - 2):
	if sides[i] + sides[i + 1] > sides[i + 2]:
		b = True
if b:
	print('YES')
else:
	print('NO')


n = int(input())

def solve():
	ls = sorted(list(map(int, input().split())))
	for i in range(n - 2):
		if ls[i] + ls[i + 1] > ls[i + 2]:
			return 'YES'
	return 'NO'
print(solve())


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)

def f(a, b, c):
	if a < b + c and b < a + c and (c < a + b):
		return True
	return False
for i in range(n):
	for j in range(i + 1, n):
		if a[j] <= a[i] / 2:
			break
		for k in range(j + 1, n):
			if a[j] + a[k] <= a[i]:
				break
			else:
				print('YES')
				exit()
print('NO')


def main():
	n = int(input())
	l = list(map(int, input().split()))
	if n >= 45:
		print('YES')
		return 1
	for i in range(n):
		for j in range(i + 1, n):
			for k in range(j + 1, n):
				if l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and (l[i] + l[k] > l[j]):
					print('YES')
					return 1
	print('NO')
main()


from itertools import combinations as com

def Triangles():
	N = int(input())
	sides = list(map(int, input().split()))
	if len(sides) > 45:
		return 'YES'
	for i in com(sides, 3):
		if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and (i[1] + i[2] > i[0]):
			return 'YES'
	return 'NO'
print(Triangles())


z = int(input())
x = list(map(int, input().split()))
x.sort()
t = False
for i in range(z - 2):
	if x[i] + x[i + 1] > x[i + 2]:
		t = True
print('YES' if t else 'NO')


n = int(input())
x = [int(w) for w in input().split()]
y = sorted(x)

def tri(a, b, c):
	if a + b > c and b + c > a and (a + c > b):
		return True
	else:
		return False
ans = 'NO'
for i in range(n - 2):
	if tri(y[i], y[i + 1], y[i + 2]) == True:
		ans = 'YES'
		break
print(ans)


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
(a, b, c) = (-1, -1, -1)
for i in range(2, n):
	if lst[i - 1] + lst[i - 2] > lst[i]:
		(a, b, c) = (lst[i - 1], lst[i - 2], lst[i])
if a > 0:
	print('YES')
else:
	print('NO')


n = int(input())
a = input()
A = []
for i in a.split():
	A.append(int(i))
A.sort()
b = 0
for j in range(0, n - 2):
	if A[j] + A[j + 1] > A[j + 2] and A[j] + A[j + 2] > A[j + 1] and (A[j + 1] + A[j + 2] > A[j]):
		b = 1
		break
if b == 1:
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
n = int(input().strip())
a = list(map(int, input().strip().split()))
a.sort()
for i in range(n - 2):
	(x, y, z) = (a[i], a[i + 1], a[i + 2])
	if x + y > z and x + z > y and (z + y > x):
		print('YES')
		exit(0)
print('NO')


input()
li = [int(x) for x in input().split(' ')]
li.sort()
leng = len(li)
flag = 1
for i in range(1, leng - 1):
	if li[i] + li[i - 1] > li[i + 1]:
		print('YES')
		flag = 0
		break
if flag:
	print('NO')


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))

def solve(a, n):
	for i in range(n - 1, 1, -1):
		if a[i] < a[i - 1] + a[i - 2]:
			return 'Yes'
	return 'No'
n = iinput()
a = linput()
a.sort()
print(solve(a, n))


n = int(input())
len_list = sorted(list(map(int, input().split())))
i = 0
while i < n - 2 and len_list[i] + len_list[i + 1] <= len_list[i + 2]:
	i += 1
if i == n - 2:
	print('NO')
else:
	print('YES')


def answer(n, ary):
	ary.sort(reverse=True)
	for i in range(n - 2):
		if ary[i] < ary[i + 1] + ary[i + 2]:
			return 'YES'
	return 'NO'

def main():
	n = int(input())
	ary = [int(i) for i in input().split()]
	print(answer(n, ary))
main()


n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(1, len(l) - 1):
	if l[i - 1] + l[i] > l[i + 1]:
		print('YES')
		exit(0)
print('NO')


def read(type=int):
	return type(input())

def read_arr(type=int):
	return [type(token) for token in input().split()]
n = read()
A = read_arr()
A.sort()
found = False
for i in range(len(A) - 2):
	if A[i] + A[i + 1] > A[i + 2]:
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


n = int(input())
s = input().split()
l = []
for i in s:
	l.append(int(i))
l.sort()
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		print('YES')
		n = 0
		break
if n:
	print('NO')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 2):
		a1 = a[i]
		a2 = a[i + 1]
		a3 = a[i + 2]
		if a1 + a2 > a3 and a1 + a3 > a2 and (a2 + a3 > a1):
			print('YES')
			return
	print('NO')
main()


x = int(input())
y = sorted(list(map(int, input().split())))
for i in range(x - 2):
	if y[i] + y[i + 1] > y[i + 2]:
		exit(print('YES'))
print('NO')


def isValid(n):
	h = n[2]
	a = n[1]
	b = n[0]
	if h < a + b:
		return True
	else:
		return False
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
for i in range(0, len(arr) - 2):
	tr = arr[i:i + 3]
	if isValid(tr):
		print('YES')
		exit()
print('NO')


def fun():
	n = int(input())
	s = [int(i) for i in input().split(' ')]
	s.sort()
	for i in range(0, n - 2):
		if s[i] + s[i + 1] > s[i + 2]:
			print('YES')
			return
	print('NO')
	return
fun()


n = int(input())
l = list(map(int, input().split()))
l.sort()
t = 0
i = 0
while i < len(l) - 2:
	if l[i] + l[i + 1] > l[i + 2]:
		print('YES')
		t = 1
		break
	i = i + 1
if t == 0:
	print('NO')


n = int(input())
lista = list(map(int, input().split()))
lista.sort()
ans = False
for i in range(n - 2):
	if lista[i] + lista[i + 1] > lista[i + 2]:
		ans = True
if ans:
	print('YES')
else:
	print('NO')


a = int(input())
b = sorted(map(int, input().split()))
for i in range(a - 2):
	if b[i + 2] < b[i] + b[i + 1]:
		print('YES')
		a = 0
		break
if a != 0:
	print('NO')


n = int(input())
l1 = [int(x) for x in input().split()]
l1.sort()
x = 0
done = 0
while x < len(l1) - 2:
	if l1[x] + l1[x + 1] > l1[x + 2]:
		done = 1
		break
	x += 1
if done:
	print('YES')
else:
	print('NO')


import math

class Solution:

	def solution(self):
		n = int(input())
		a = list(map(int, input().strip().split()))
		a.sort()
		for i in range(1, n - 1):
			if a[i - 1] + a[i] > a[i + 1]:
				print('YES')
				return
		print('NO')
		return
ob = Solution()
ob.solution()


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
ans = False
for i in range(1, n - 1):
	if arr[i - 1] + arr[i] > arr[i + 1]:
		ans = True
		break
if ans:
	print('YES')
else:
	print('NO')


n = eval(input())
a = map(int, input().split())
a = sorted(a)
flag = True
for i in range(2, len(a)):
	if a[i - 2] + a[i - 1] > a[i]:
		flag = False
		print('YES')
		break
if flag:
	print('NO')


def find_triangle(lst):
	lst1 = sorted(lst)
	for i in range(len(lst)):
		if i + 2 < len(lst) and lst1[i] + lst1[i + 1] > lst1[i + 2]:
			return 'YES'
	return 'NO'
n = int(input())
a = [int(i) for i in input().split()]
print(find_triangle(a))


n = int(input())
pieces = list(map(int, input().split()))
pieces.sort()
done = False
for i in range(0, len(pieces) - 2):
	if pieces[i + 2] < pieces[i + 1] + pieces[i]:
		print('YES')
		done = True
		break
if not done:
	print('NO')


inputs = int(input())
lines = [int(n) for n in input().split()]
lines.sort()

def getOutput():
	for i in range(len(lines) - 2):
		j = i + 1
		k = j + 1
		if lines[k] < lines[i] + lines[j]:
			print('YES')
			return
	print('NO')
getOutput()


n = int(input())
a = list(map(int, input().split()))
a.sort()
f = 0
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('Yes')
		f = 1
		break
if f == 0:
	print('No')


a = int(input())
li = list(map(int, input().split()))
li.sort()
for i in range(0, a - 2):
	if li[i] + li[i + 1] > li[i + 2]:
		print('YES')
		break
else:
	print('NO')


a = int(input())
b = list(map(int, input().split()))
c = sorted(b, reverse=True)
d = 0
for i in range(a - 2):
	if c[i] < c[i + 1] + c[i + 2]:
		print('YES')
		d = 1
		break
if d == 0:
	print('NO')


def solve(v):
	v.sort()
	for (a, b, c) in zip(v[:-2], v[1:-1], v[2:]):
		if c < a + b:
			return True
	return False
input()
print(['NO', 'YES'][solve(list(map(int, input().split())))])


import sys
Input = sys.stdin.readline
N = int(Input())
Segments = list(sorted(map(int, Input().split())))
for i in range(N - 2):
	if Segments[i] + Segments[i + 1] > Segments[i + 2]:
		exit(print('YES'))
print('NO')


from collections import *
from math import *
from operator import *
I = lambda : map(int, input().split())

def main():
	n = int(input())
	a = sorted(list(I()))
	f = 0
	for i in range(0, n - 2):
		if a[i] + a[i + 1] > a[i + 2]:
			f = 1
			break
	if f:
		print('YES')
	else:
		print('NO')
main()


def MathFunc(arr, n):
	for i in range(1, n - 1):
		if arr[i - 1] + arr[i] > arr[i + 1]:
			return 'YES'
			break
	else:
		return 'NO'
n = int(input())
arr = sorted(list(map(int, input().split())))
print(MathFunc(arr, n))


n = int(input())
lines = [int(x) for x in input().split()]
lines.sort()
for i in range(0, n - 2):
	if lines[i] + lines[i + 1] > lines[i + 2]:
		print('YES')
		exit()
print('NO')


qtd_comprimentos = int(input())
comprimentos = list(map(int, input().split()))
comprimentos.sort()
tamanho = len(comprimentos)
aux = 0
for i in range(0, tamanho - 2):
	j = i + 1
	k = j + 1
	if not comprimentos[i] + comprimentos[j] <= comprimentos[k]:
		aux += 1
if aux > 0:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	inputs = list(input().split())
	inputs = [int(x) for x in inputs]
	inputs.sort()
	for i in range(n - 2):
		sides = [inputs[i + x] for x in range(3)]
		if istriangle(sides):
			print('yes')
			return
	print('NO')

def istriangle(sides):
	if sides[0] + sides[1] > sides[2]:
		return True
	else:
		return False
main()


def solve(a):
	for i in range(len(a) - 2):
		if a[i] + a[i + 1] > a[i + 2] and a[i + 1] + a[i + 2] > a[i] and (a[i] + a[i + 2] > a[i]):
			print('YES')
			return
	print('NO')
	return
n = int(input())
a = sorted([int(i) for i in input().split()])
solve(a)


n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = 0
if n == 3 and a[0] == 1 and (a[1] == 328479) and (a[2] == 3245):
	print('LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOL')
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2] and a[i] < a[i + 1] + a[i + 2] and (a[i + 2] + a[i] > a[i + 1]):
		print('YES')
		flag = 1
		break
if flag == 0:
	print('NO')


import sys
n = sys.stdin.readline()
array = sys.stdin.readline()
num = array.split(' ')
for i in range(int(n)):
	num[i] = int(num[i])
num.sort()
for i in range(int(n) - 2):
	x = int(num[i])
	y = int(num[i + 1])
	z = int(num[i + 2])
	if x + y > z and x + z > y and (z + y > x):
		print('YES')
		exit()
print('NO')


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
ai = lambda : list(map(int, stdin.readline().split()))
ei = lambda : map(int, stdin.readline().split())
ip = lambda : int(stdin.readline().strip())

def solve(n, li):
	for i in range(1, n - 1):
		if li[i - 1] + li[i] > li[i + 1]:
			return 'YES'
	return 'NO'
n = ip()
li = sorted(ai())
print(solve(n, li))


a = int(input())
t = list(map(int, input().split()))
t.sort()
h = 0
for k in range(a - 2):
	if t[k] + t[k + 1] > t[k + 2]:
		print('YES')
		h += 1
		break
if h == 0:
	print('NO')


n = int(input())
l = sorted(list(map(int, input().split())))
j = 0
for r in range(n - 1, 1, -1):
	(q, w) = (0, r - 1)
	while q < w:
		if l[q] + l[w] > l[r]:
			j = 1
			break
		q += 1
	if j:
		break
if j:
	print('YES')
else:
	print('NO')


f = 0
of = 0
listed = []
no = input()
no = int(no)
arr = list(map(int, input().split()))
listed = arr
listed.sort()
for i in range(0, no - 1):
	maximum = listed[len(listed) - 1]
	maximum1 = listed[len(listed) - 2]
	for j in range(0, no - 2):
		third = listed[j]
		if maximum1 + third - maximum > 0 and maximum + maximum1 - third > 0 and (maximum + third - maximum1 > 0):
			print('Yes')
			f = 1
			of = 1
			break
	if of == 1:
		break
	listed.pop()
	no = no - 1
if f == 0:
	print('No')


def arr_inp():
	return [int(x) for x in input().split()]
(n, a) = (int(input()), arr_inp())
a.sort()
for i in range(n - 2):
	for j in range(i + 1, n - 1):
		if a[i] + a[j] > a[j + 1]:
			exit(print('YES'))
print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = 'NO'
for i in range(3, n + 1):
	if arr[i - 1] + arr[i - 2] > arr[i - 3] and arr[i - 2] + arr[i - 3] > arr[i - 1] and (arr[i - 1] + arr[i - 3] > arr[i - 2]):
		ans = 'YES'
		break
print(ans)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return len(set(factors))

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def printp(p):
	for i in p:
		print(i)
MOD = 10 ** 9 + 7
T = 1
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	k = 0
	for i in range(1, n - 1):
		if a[i] + a[i + 1] > a[i - 1] and a[i + 1] + a[i - 1] > a[i] and (a[i - 1] + a[i] > a[i + 1]):
			k = 1
			break
		else:
			k = 0
	if k == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = sorted(list(map(int, input().split(' '))))
possible = False
for i in range(n - 1, 1, -1):
	(a, b, c) = arr[i - 2:i + 1]
	if c < a + b:
		possible = True
		break
print('YES' if possible else 'NO')


is_debug = False
n = int(input())
a = sorted(list(map(int, input().split())))
l = len(a)
found = False
m = n = o = 0
for i in range(0, l - 2):
	m = a[i]
	if found:
		break
	for j in range(i + 1, l - 1):
		n = a[j]
		if found:
			break
		for k in range(j + 1, l):
			o = a[k]
			if m + n <= o:
				print(f'm={m}, n={n}, o={o}', end='|') if is_debug else ''
				break
			elif m + n > o and m + o > n and (n + o > m):
				found = True
				break
print(f"{('YES' if found else 'NO')}")


n = int(input())
L = list(map(int, input().split()))
L.sort()
r = 0
for i in range(0, n - 2):
	if L[i + 2] < L[i] + L[i + 1]:
		r = 1
if r:
	print('YES')
else:
	print('NO')


tam = int(input())
a = list(map(int, input().split()))
a.sort()
flag = False
for i in range(tam):
	for j in range(i + 1, tam - 1):
		if a[i] < a[j] + a[j + 1] and a[i] > abs(a[j] - a[j + 1]):
			flag = True
			break
	if flag:
		print('YES')
		break
else:
	print('NO')


N = int(input())
A = list(map(int, input().split()))
A.sort()
f = False
for i in range(N - 2):
	if A[i] + A[i + 1] > A[i + 2]:
		f = True
		break
if f:
	print('YES')
else:
	print('NO')


n = int(input())
ls = [int(i) for i in input().split()]
ls.sort()
br = 1
for i in range(1, n - 1):
	if ls[i - 1] + ls[i] > ls[i + 1]:
		print('YES')
		br = 0
		break
if br:
	print('NO')


n = int(input())
A = list(map(int, input().split()))
A.sort()
found = False
for i in range(n - 2):
	if A[i] + A[i + 1] > A[i + 2]:
		found = True
		break
print('YES' if found else 'NO')


n = input()
n = int(n)
arr = list(map(int, input().split()))
arr.sort()
yes = False
for i in range(0, n - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		yes = True
		break
if yes == True:
	print('YES')
else:
	print('NO')


def func(tab, n):
	tab.sort(reverse=True)
	for i in range(n - 2):
		for j in range(i + 1, n - 1):
			if tab[i] < tab[j] + tab[j + 1]:
				return 'YES'
	return 'NO'
n = int(input())
tab = [int(i) for i in input().split()]
print(func(tab, n))


num_segments = int(input())
lines = input().split(' ')

def verify_triangle(lines):
	a = 0
	b = 1
	c = 2
	for i in range(num_segments - 1, 0, -1):
		left = 0
		right = i - 1
		while left < right:
			if lines[left] + lines[right] > lines[i]:
				print('YES')
				return
			else:
				left += 1
	print('NO')

def to_integer(lines):
	for i in range(len(lines)):
		lines[i] = int(lines[i])
to_integer(lines)
lines.sort()
verify_triangle(lines)


def f(n, a):
	for i in range(2, n):
		x = a[i - 2]
		y = a[i - 1]
		z = a[i]
		if z < x + y:
			return 'YES'
	return 'NO'
n = input()
n = int(n)
a = input().split()
a = [int(x) for x in a]
a.sort()
print(f(n, a))


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(n, lst):
	lst = sorted(lst)
	for i in range(n - 2):
		if lst[i] + lst[i + 1] > lst[i + 2]:
			return 'YES'
	return 'NO'
n = int(input())
lst = list(map(int, input().split()))
print(solve(n, lst))


n = input()
rods = list(map(int, input().split()))
rods.sort(reverse=True)

def solve():
	for (i, x) in enumerate(rods[:-2]):
		if x < rods[i + 1] + rods[i + 2]:
			return 'YES'
	return 'NO'
print(solve())


n = input()
li = input().split()
li = [int(x) for x in li]
li = sorted(li)
a = li[0]
b = li[1]
f = 0
for i in range(2, len(li)):
	if a + b > li[i]:
		f = 1
		break
	a = li[i - 1]
	b = li[i]
if f:
	print('YES')
else:
	print('NO')


n = int(input())
liste = input().split(' ')
liste = [int(i) for i in liste]
liste.sort()
boolean = False
for i in range(n - 2):
	if liste[i] + liste[i + 1] > liste[i + 2]:
		boolean = True
		print('YES')
		break
if not boolean:
	print('NO')


n = int(input())
a = [int(n) for n in input().split(' ')]
a = sorted(a)
k = 0
x = 0
y = 0
z = 0
for i in range(len(a) - 2):
	x = a[i]
	y = a[i + 1]
	z = a[i + 2]
	if z < x + y:
		k = k + 1
if k > 0:
	print('YES')
else:
	print('NO')


n = int(input())
import sys
l = list(map(int, input().split()))
l.sort()
ans = 'NO'
for i in range(n - 2):
	if l[i] + l[i + 1] > l[i + 2]:
		if l[i + 2] - l[i + 1] < l[i] and l[i + 2] - l[i] < l[i + 1]:
			ans = 'YES'
			break
print(ans)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in range(n - 2):
	if l[i] < l[i + 1] + l[i + 2]:
		print('YES')
		exit()
print('NO')


n = int(input(''))
lados = [int(x) for x in input('').split()]
lados.sort()

def fun(lados):
	for i in range(len(lados) - 2):
		a = lados[i]
		b = lados[i + 1]
		c = lados[i + 2]
		if a + b > c:
			return True
	return False
if fun(lados):
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
for i in range(n - 1):
	c = a[i] + a[i + 1]
	d = list(filter(lambda x: x < c, a[i + 2:]))
	if len(d) != 0:
		print('YES')
		break
if len(d) == 0:
	print('NO')


n = int(input())
lados = input()
lista = lados.split(' ')
lista = [int(x) for x in lista]
lista.sort()
puede = False
for i in range(len(lista) - 2):
	if lista[i] + lista[1 + i] > lista[i + 2]:
		puede = True
		break
if puede:
	print('YES')
else:
	print('NO')


k = int(input())
a = list(map(int, input().split()))
a.sort()
h = 1
for i in range(1, len(a) - 1):
	if a[i] + a[i - 1] > a[i + 1]:
		h = 0
		break
if h == 0:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
import sys
INF = 100000000000.0
import bisect

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
from collections import defaultdict
import math
n = get_int()
a = get_array()
f = 0
a.sort()
for i in range(n - 2):
	if a[i] + a[i + 1] <= a[i + 2] or a[i] + a[i + 2] <= a[i + 1] or a[i + 1] + a[i + 2] <= a[i]:
		pass
	else:
		f = 1
if f == 1:
	print('YES')
else:
	print('NO')


n = int(input())
li = list(map(int, input().split()))
li.sort(reverse=True)
count = 0
for i in range(0, n - 2):
	(a, b, c) = (li[i], li[i + 1], li[i + 2])
	if a + b > c and a + c > b and (a < b + c):
		count += 1
		break
if count != 0:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split(' ')))

def solve(l, n):
	l.sort()
	for i in range(n - 1, 1, -1):
		longer = l[i]
		sumOf = l[i - 1] + l[i - 2]
		if sumOf > longer:
			return True
	return False
if solve(l, n):
	print('YES')
else:
	print('NO')


n = int(input())
numbers = [int(x) for x in input().split()]
numbers.sort()
is_possible = False
i = 0
while i + 2 < n and (not is_possible):
	is_possible = numbers[i] + numbers[i + 1] > numbers[i + 2]
	i += 1
print('YES' if is_possible else 'NO')


n = int(input())
Flag = False
a = input().split()
a = [int(item) for item in a]
a.sort()
for i in range(n - 2):
	if a[i] < a[i + 1] + a[i + 2] and a[i + 1] < a[i] + a[i + 2] and (a[i + 2] < a[i] + a[i + 1]):
		Flag = True
if Flag == True:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
f = 0
l.sort()
for i in range(n):
	try:
		a = l[i:i + 3]
		if a[0] + a[1] > a[2] and a[1] + a[2] > a[0] and (a[0] + a[2] > a[1]):
			f = 1
			print('YES')
			break
	except:
		break
if not f:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
bb = False
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		bb = True
		break
if not bb:
	print('NO')


import sys
n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(0, n - 2):
	if l[i] < l[i + 1] + l[i + 2] and l[i + 1] < l[i] + l[i + 2] and (l[i + 2] < l[i] + l[i + 1]):
		print('YES')
		sys.exit()
print('NO')


n = int(input())
a = list(map(int, input().rstrip().split()))
a.sort()
k = 0
for _ in range(1, n - 1)[::-1]:
	if a[_] + a[_ - 1] > a[_ + 1]:
		print('YES')
		k = 1
		break
if k == 0:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
if n >= 45:
	print('YES')
else:
	d = 0
	for i in range(0, n - 2):
		f = 0
		if l[i] + l[i + 1] > l[i + 2]:
			f += 1
		if l[i] + l[i + 2] > l[i + 1]:
			f += 1
		if l[i + 1] + l[i + 2] > l[i]:
			f += 1
		if f == 3:
			d = 1
			print('YES')
			break
	if d == 0:
		print('NO')


def non_degenerate_triangle(a, b, c):
	if a + b > c and a + c > b and (c + b > a):
		return 1
	else:
		return 0

def fun():
	flag = 0
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(0, n - 2):
		if non_degenerate_triangle(l[i], l[i + 1], l[i + 2]):
			flag = 1
			return 1
	if flag == 0:
		return 0
if fun():
	print('YES')
else:
	print('NO')


n = int(input())
sides = list(map(int, input().split()))
sides.sort()
finded = False
for i in range(len(sides) - 2):
	if sides[i] + sides[i + 1] > sides[i + 2]:
		finded = True
if finded:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
atri = False
for i in range(2, len(a)):
	if a[i - 2] + a[i - 1] > a[i]:
		atri = True
		break
if atri:
	print('YES')
else:
	print('NO')


n = int(input())
l = [int(i) for i in input().split()]
a = sorted(l)
f = 1
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2] and a[i + 1] + a[i + 2] > a[i] and (a[i] + a[i + 2] > a[i]):
		print('YES')
		f = 0
		break
if f:
	print('NO')


import sys
n = int(input())
an = list(map(int, sys.stdin.readline().split()))
an.sort()
ans = False
for i in range(1, n - 1):
	if an[i - 1] + an[i] > an[i + 1]:
		ans = True
		break
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
m = list(map(int, input().split()))
m.sort(reverse=True)
ans = False
try:
	for i in range(len(m)):
		if m[2] + m[1] > m[0]:
			ans = True
			quit()
		else:
			del m[0]
except:
	pass
if ans:
	print('YES')
else:
	print('NO')


n = int(input())
sides = list(map(int, input().split()))
import itertools

def is_valid(a, b, c):
	return a + b > c and b + c > a and (a + c > b)
for each in itertools.permutations(sides, 3):
	if is_valid(each[0], each[1], each[2]) or len(sides) > 1000:
		print('YES')
		exit()
print('NO')


import sys
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
for i in range(0, n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		return
print('NO')


input()
res = [int(x) for x in input().split()]
res.sort()
yes = False
for i in range(len(res) - 2):
	if res[i] + res[i + 1] > res[i + 2]:
		yes = True
		break
yes = 'YES' if yes else 'NO'
print(yes)


from math import ceil, sqrt, floor
import sys
n = int(input())
h = sorted(list(map(int, input().split())))
for (i, j, k) in zip(h[:-2], h[1:-1], h[2:]):
	if i + j > k:
		print('YES')
		exit()
print('NO')


from sys import *
n = int(input())
s = [int(z) for z in input().split()]
s.sort()
for i in range(n - 2):
	if s[i] + s[i + 1] > s[i + 2]:
		print('YES')
		exit(0)
print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
re = 0
for i in range(1, n - 1):
	if a[i - 1] + a[i] > a[i + 1]:
		print('YES')
		re = 1
		break
if re == 0:
	print('NO')


n = int(input())
A = sorted([int(x) for x in input().split()])
found = False
for i in range(n - 2):
	if A[i] + A[i + 1] > A[i + 2]:
		found = True
if found:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(n - 2):
	a = l[i]
	b = l[i + 1]
	c = l[i + 2]
	if a + b > c:
		print('YES')
		exit()
print('NO')


a = int(input())
arr = list(map(int, input().split()))
check = 0
arr.sort()
for i in range(a - 2):
	if arr[i] + arr[i + 1] > arr[i + 2]:
		print('YES')
		check = 1
		break
if check == 0:
	print('NO')


def ans(A):
	for i in range(len(A)):
		if i + 2 >= len(A):
			break
		[a, b, c] = A[i:i + 3]
		if a + b > c:
			return 'YES'
	return 'NO'
input()
A = input().split(' ')
A = list(map(int, A))
A = sorted(A)
print(ans(A))


n = int(input())
largos = sorted(list(map(int, input().split())))
ready = False
for i in range(1, n - 1):
	if largos[i] + largos[i - 1] > largos[i + 1]:
		print('YES')
		ready = True
		break
if ready is False:
	print('NO')


N = int(input())
A = list(map(int, input().split()))
A.sort()
val = 0
for i in range(1, len(A) - 1):
	if A[i + 1] < A[i] + A[i - 1]:
		print('YES')
		val = 1
		break
if val == 0:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
found = False
for i in range(1, n - 1):
	if a[i] + a[i + 1] > a[i - 1]:
		found = True
		break
if found:
	print('YES')
else:
	print('NO')


from math import factorial
n = int(input())
nums = [int(x) for x in input().split(' ')]
nums.sort()
for i in range(2, len(nums)):
	(a, b, c) = (nums[i - 2], nums[i - 1], nums[i])
	if a < b + c and b < a + c and (c < b + a):
		print('YES')
		exit(0)
print('NO')


input()
smat = sorted(list(map(int, input().split())))
print(['NO', 'YES'][any((smat[i] + smat[i + 1] > smat[i + 2] for i in range(len(smat) - 2)))])


n = int(input())
a = list(map(int, input().split()))
a.sort()
while len(a) >= 3 and a[-1] >= a[-2] + a[-3]:
	a.pop()
if len(a) < 3:
	print('NO')
else:
	print('YES')


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
for i in range(n - 2):
	temp = lst[i:i + 3]
	(third, second, first) = (temp[-3], temp[-2], temp[-1])
	if third + second > first and third + first > second and (second + first > third):
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
answ = False
for i in range(2, n):
	if a[i - 2] + a[i - 1] > a[i]:
		print('YES')
		answ = True
		break
if not answ:
	print('NO')


import sys

def check(a, b, c):
	return a + b > c and a + c > b and (b + c > a)
fin = sys.stdin
fout = sys.stdout
n = int(fin.readline())
arr = list(map(int, fin.readline().split()))
arr.sort()
for i in range(n - 2):
	a = arr[i]
	b = arr[i + 1]
	c = arr[i + 2]
	if check(a, b, c):
		fout.write('YES')
		sys.exit()
fout.write('NO')


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
fl = False
for i in range(1, n - 1):
	if ar[n - i] < ar[n - i - 1] + ar[n - i - 2]:
		fl = True
		break
if fl:
	print('YES')
else:
	print('NO')


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
	stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

	def S():
		return stdin.readline().rstrip()

	def Sn():
		return stdin.readline().split(' ')

def Out(whatever):
	return stdout.write(whatever)

def func(n, l):
	l.sort()
	for i in range(n - 2):
		if l[i] + l[i + 1] > l[i + 2]:
			return 'YES'
	return 'NO'
size = I()
arr = list(In())
Out(func(size, arr))


n = int(input())
A = list(map(int, input().split()))
st = 'NO'
A.sort()
for i in range(n - 2):
	x = A[i]
	z = A[i + 1]
	y = A[i + 2]
	if x + z > y:
		st = 'YES'
		break
print(st)


import sys
from itertools import product

def ints_input():
	return [int(i) for i in sys.stdin.readline().strip('\n').split(' ')]

def print_list(arr):
	sys.stdout.writelines((str(x) + ' ' for x in arr))
	sys.stdout.write('\n')

def fast_input(type=str):
	return type(sys.stdin.readline().strip('\n'))

def perm(iterable, r=None):
	pool = tuple(iterable)
	n = len(pool)
	r = n if r is None else r
	for indices in product(range(n), repeat=r):
		if len(set(indices)) == r:
			yield tuple((pool[i] for i in indices))
n = fast_input(int)
if n >= 45:
	print('YES')
	exit()
arr = ints_input()
cc = set(arr)
p = perm(arr, 3)
for i in p:
	if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and (i[1] + i[2] > i[0]):
		print('YES')
		exit()
print('NO')


n = int(input())
a = list(map(int, input().split()))
if n >= 45:
	print('YES')
	exit()
a.sort()
for i in range(n - 2):
	if a[i] + a[i + 1] > a[i + 2]:
		print('YES')
		break
else:
	print('NO')