Connect the countless points with lines, till we reach the faraway yonder.

There are n points on a coordinate plane, the i-th of which being (i, y_{i}).

Determine whether it's possible to draw two parallel and non-overlapping lines, such that every point in the set lies on exactly one of them, and each of them passes through at least one point in the set.


-----Input-----

The first line of input contains a positive integer n (3 ≤ n ≤ 1 000) — the number of points.

The second line contains n space-separated integers y_1, y_2, ..., y_{n} ( - 10^9 ≤ y_{i} ≤ 10^9) — the vertical coordinates of each point.


-----Output-----

Output "Yes" (without quotes) if it's possible to fulfill the requirements, and "No" otherwise.

You can print each letter in any case (upper or lower).


-----Examples-----
Input
5
7 5 8 6 9

Output
Yes

Input
5
-1 -2 0 0 -5

Output
No

Input
5
5 4 3 2 1

Output
No

Input
5
1000000000 0 0 0 0

Output
Yes



-----Note-----

In the first example, there are five points: (1, 7), (2, 5), (3, 8), (4, 6) and (5, 9). It's possible to draw a line that passes through points 1, 3, 5, and another one that passes through points 2, 4 and is parallel to the first one.

In the second example, while it's possible to draw two lines that cover all points, they cannot be made parallel.

In the third example, it's impossible to satisfy both requirements at the same time.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Geometry

Complete search


Solutions:
n = int(input())
l = list(map(int, input().split()))
l2 = [0, 0, 0]
l2[0] = l[0] - l[1]
l2[1] = l[1] - l[2]
l2[2] = (l[0] - l[2]) / 2
x = -1
for j in range(3):
	l1 = []
	for i in range(n):
		l1.append(l[i] + l2[j] * (i + 1))
	if len(set(l1)) == 2:
		print('Yes')
		exit()
print('No')


n = int(input())
y = list(map(int, input().split()))
for i in range(1, n):
	a = []
	for j in range(n):
		if (y[j] - y[0]) * i != (y[i] - y[0]) * j:
			a.append(j)
	if a:
		ok = len(a) < 2 or (y[i] - y[0]) * (a[1] - a[0]) == (y[a[1]] - y[a[0]]) * i
		for j in range(2, len(a)):
			ok &= (y[a[j]] - y[a[0]]) * (a[1] - a[0]) == (y[a[1]] - y[a[0]]) * (a[j] - a[0])
		if ok:
			print('Yes')
			exit()
y = y[::-1]
for i in range(1, n):
	a = []
	for j in range(n):
		if (y[j] - y[0]) * i != (y[i] - y[0]) * j:
			a.append(j)
	if a:
		ok = len(a) < 2 or (y[i] - y[0]) * (a[1] - a[0]) == (y[a[1]] - y[a[0]]) * i
		for j in range(2, len(a)):
			ok &= (y[a[j]] - y[a[0]]) * (a[1] - a[0]) == (y[a[1]] - y[a[0]]) * (a[j] - a[0])
		if ok:
			print('Yes')
			exit()
print('No')


def read_ints():
	return [int(i) for i in input().split()]
n = int(input())
p = [(i, int(k)) for (i, k) in enumerate(input().split())]
dist = set()
for i in range(1, n):
	dist.add(p[i][1] - p[i - 1][1])
if len(dist) == 1:
	print('No')
	return
dist = set()
for i in range(2, n):
	dist.add(p[i][1] - p[i - 1][1])
if len(dist) == 1:
	print('Yes')
	return
splited_pnt = dict()
for i in range(1, n):
	l = (p[i][1] - p[0][1]) / p[i][0]
	if l not in splited_pnt:
		splited_pnt[l] = []
	splited_pnt[l].append(i)
for (l, pnt) in splited_pnt.items():
	if len(p) - len(pnt) < 3:
		print('Yes')
		return
	other = [i for i in range(n) if i not in set(pnt + [0])]
	if all(((p[i][1] - p[other[0]][1]) / (p[i][0] - p[other[0]][0]) == l for i in other[1:])):
		print('Yes')
		return
print('No')


def covers(n, a, num, den):
	start = a[0]
	used = [False] * n
	used[0] = True
	for i in range(1, n):
		if den * (a[i] - a[0]) == num * i:
			used[i] = True
	first_unused = -1
	for i in range(n):
		if not used[i]:
			first_unused = i
			break
	if first_unused == -1:
		return False
	for i in range(n):
		if used[i]:
			continue
		if den * (a[i] - a[first_unused]) == num * (i - first_unused):
			used[i] = True
	return all(used)

def main():
	n = int(input())
	a = list(map(int, input().split()))
	if n < 2:
		print('No')
	elif n == 2:
		print('Yes')
	else:
		diffs = set((a[i] - a[i - 1] for i in range(2, n)))
		d = list(diffs)[0]
		solved = len(diffs) == 1 and a[1] - a[0] != d
		for i in range(1, n):
			if covers(n, a, a[i] - a[0], i):
				solved = True
				break
		print('Yes' if solved else 'No')
main()


def test(id1, id2, l, n):
	a = l[id1] - l[id2]
	b = id2 - id1
	c = id1 * l[id2] - id2 * l[id1]
	d = []
	for i in range(n):
		if a * i + b * l[i] + c != 0:
			d += [i]
	if len(d) == 0:
		return False
	if len(d) == 1:
		return True
	aa = l[d[0]] - l[d[1]]
	bb = d[1] - d[0]
	cc = d[0] * l[d[1]] - d[1] * l[d[0]]
	for i in range(len(d)):
		if aa * d[i] + bb * l[d[i]] + cc != 0:
			return False
	return (l[id1] - l[id2]) / (id1 - id2) == (l[d[1]] - l[d[0]]) / (d[1] - d[0])
n = int(input())
l = [int(i) for i in input().split()]
print('Yes' if test(0, 1, l, n) or test(1, 2, l, n) or test(0, 2, l, n) else 'No')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	if a[1] - a[0] == a[2] - a[1]:
		d = a[1] - a[0]
		c1 = a[0]
		c2 = 'no'
		for i in range(3, n):
			if i * d + c1 == a[i]:
				pass
			elif c2 == 'no':
				c2 = a[i] - d * i
			elif i * d + c2 == a[i]:
				pass
			else:
				print('No')
				return
		if c2 == 'no':
			print('No')
		else:
			print('Yes')
		return
	else:
		f = True
		d = a[1] - a[0]
		c1 = a[0]
		c2 = a[2] - 2 * d
		for i in range(3, n):
			if a[i] == i * d + c1 or a[i] == i * d + c2:
				pass
			else:
				f = False
				break
		if f:
			print('Yes')
			return
		f = True
		d = a[2] - a[1]
		c1 = a[1] - d
		c2 = a[0]
		for i in range(3, n):
			if a[i] == i * d + c1 or a[i] == i * d + c2:
				pass
			else:
				f = False
				break
		if f:
			print('Yes')
			return
		f = True
		d = (a[2] - a[0]) / 2
		c1 = a[0]
		c2 = a[1] - d
		for i in range(3, n):
			if a[i] == i * d + c1 or a[i] == i * d + c2:
				pass
			else:
				f = False
				break
		if f:
			print('Yes')
		else:
			print('No')
main()


from fractions import Fraction
from itertools import combinations
N = int(input())
YL = list(map(int, input().strip().split()))
YM = dict(enumerate(YL, start=1))

def get_b(k, x):
	y = YM[x]
	b = y - k * x
	return b

def extract(x1, x2):
	y1 = YM[x1]
	y2 = YM[x2]
	k = Fraction(y2 - y1, x2 - x1)
	b = get_b(k, x1)
	return (k, b)

def fits(k, b, x):
	return get_b(k, x) == b

def fits3(x1, x2, x):
	(k, b) = extract(x1, x2)
	return fits(k, b, x)

def getk5():
	k_count = {}
	num = min(5, N)
	for (x1, x2) in combinations(range(1, num + 1), 2):
		(k, _) = extract(x1, x2)
		k_count[k] = k_count.get(k, 0) + 1
	for (k, count) in k_count.items():
		if count > 2:
			return k
	return None

def main():
	if N == 3:
		print('Yes' if not fits3(1, 2, 3) else 'No')
		return
	k = getk5()
	if k is None:
		if N == 4:
			x1 = 1
			for x2 in (2, 3, 4):
				(k12, b12) = extract(x1, x2)
				(x3, x4) = [x for x in (1, 2, 3, 4) if x != x1 and x != x2]
				(k34, b34) = extract(x3, x4)
				if k12 == k34 and b12 != b34:
					print('Yes')
					return
			print('No')
			return
		print('No')
		return
	b_set = set()
	for x in range(1, N + 1):
		b_set.add(get_b(k, x))
	print('Yes' if len(b_set) == 2 else 'No')
main()


from math import isclose
n = int(input())
y = [0] + list(map(int, input().split()))
ans = True
if n == 4:
	if (y[1] - y[3]) / 2 == (y[2] - y[4]) / 2 or (y[1] - y[4]) / 3 == y[2] - y[3]:
		print('Yes')
		exit(0)
catch = None
for z in [1, 2]:
	c = {}
	for i in range(z + 1, len(y)):
		k = (y[i] - y[z]) / (i - z)
		if k not in c:
			c[k] = 1
		else:
			catch = k
			break
	if catch != None:
		break
else:
	catch = y[2] - y[1]
y_new = []
for i in range(2, len(y)):
	k = (y[i] - y[1]) / (i - 1)
	if not isclose(k, catch):
		y_new.append((i, y[i]))
if not y_new:
	ans = False
elif len(y_new) == 1:
	ans = True
else:
	for i in range(1, len(y_new)):
		k = (y_new[0][1] - y_new[i][1]) / (y_new[0][0] - y_new[i][0])
		if not isclose(catch, k):
			ans = False
			break
if ans:
	print('Yes')
else:
	print('No')


n = int(input())
yi = list(map(int, input().split()))
steps = (yi[1] - yi[0], (yi[2] - yi[0]) / 2, yi[2] - yi[1])
if any((len(set(l)) == 2 for l in [[y - i * step for (i, y) in enumerate(yi)] for step in steps])):
	print('Yes')
else:
	print('No')


n = input()
y = list(map(int, input().split()))

def chk(limit):
	return len(set((2 * yi - limit * i for (i, yi) in enumerate(y)))) == 2
s = (2 * (y[1] - y[0]), 2 * (y[2] - y[1]), y[2] - y[0])
print('Yes' if any((chk(x) for x in s)) else 'No')


n = int(input())
p = list(map(int, input().split(' ')))
rest = [True] * n
ct = 0
slp = float('inf')

def slope(i, j):
	return (p[j] - p[i]) / (j - i)

def restcol():
	l = [i for i in range(n) if rest[i]]
	if len(l) == 1:
		return True
	s = slope(l[0], l[1])
	for i in range(2, len(l)):
		if slope(l[0], l[i]) != s:
			return False
	return True

def restslp():
	l = [i for i in range(n) if rest[i]]
	if len(l) == 1:
		return slp
	return slope(l[0], l[1])
wp0 = {}
for i in range(1, n):
	s = slope(0, i)
	if s not in wp0:
		wp0[s] = 0
	wp0[s] += 1
for k in wp0:
	if wp0[k] == n - 1:
		ct = 2
	if wp0[k] >= 2:
		ct += 1
		slp = k
if ct > 1:
	print('No')
elif ct == 1:
	rest[0] = False
	for i in range(1, n):
		if slope(0, i) == slp:
			rest[i] = False
	if restcol() and restslp() == slp:
		print('Yes')
	else:
		print('No')
else:
	rest[0] = False
	res = restcol()
	rest[1] = False
	res |= restcol() and restslp() == slope(0, 1)
	rest[1] = True
	rest[2] = False
	res |= restcol() and restslp() == slope(0, 2)
	rest = [True] * n
	rest[1] = rest[2] = False
	slp = slope(1, 2)
	for i in range(3, n):
		if slope(1, i) == slp:
			rest[i] = False
	res |= restcol() and restslp() == slp
	if res:
		print('Yes')
	else:
		print('No')


n = int(input())
y = list(map(int, input().split()))

def check(d):
	return len(set((2 * yi - d * i for (i, yi) in enumerate(y)))) == 2
print('Yes' if any((check(d) for d in [2 * (y[1] - y[0]), 2 * (y[2] - y[1]), y[2] - y[0]])) else 'No')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
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')
n = int(input())
d = list(map(int, input().split()))
(a, b, c) = d[:3]
if b - a == c - b:
	pr = b - a
	ncnt = 0
	for i in range(3, n):
		if (d[i] - c) / (i - 2) != pr:
			if ncnt:
				if (d[i] - pz) / (i - pind) != pr:
					print('No')
					exit()
			else:
				(pz, pind) = (d[i], i)
				ncnt = 1
	if ncnt:
		print('Yes')
	else:
		print('No')
else:
	p1 = p2 = p3 = True
	(pr1, pz1, pind1) = (b - a, c, 2)
	(pr2, pz2, pind2) = (c - b, a, 0)
	(pr3, pz3, pind3) = ((c - a) / 2, b, 1)
	ncnt = 1
	for i in range(3, n):
		if (d[i] - b) / (i - 1) != pr1:
			if (d[i] - pz1) / (i - pind1) != pr1:
				p1 = False
		if (d[i] - c) / (i - 2) != pr2:
			if (d[i] - pz2) / (i - pind2) != pr2:
				p2 = False
		if (d[i] - c) / (i - 2) != pr3:
			if (d[i] - pz3) / (i - pind3) != pr3:
				p3 = False
	print('Yes' if p1 or p2 or p3 else 'No')


def run():
	n = int(input())
	a = [int(x) for x in input().split()]
	_s = set(a)
	if len(_s) == 1:
		print('No')
		return
	if len(_s) == 2:
		print('Yes')
		return

	def check(dy, base):
		st = [False] * n
		for i in range(n):
			if (a[i] - a[base]) * 2 == dy * (i - base):
				st[i] = True
		for (i, s) in enumerate(st):
			if not s:
				newbase = i
				break
		else:
			return False
		base = newbase
		for i in range(n):
			if (a[i] - a[base]) * 2 == dy * (i - base):
				st[i] = True
		return not False in st
	if check((a[1] - a[0]) * 2, 0) or check((a[2] - a[1]) * 2, 1) or check(a[2] - a[0], 0):
		print('Yes')
	else:
		print('No')
run()


n = int(input())
l = [int(i) for i in input().split()]
slope = (l[n - 1] - l[0]) / (n - 1)
f = 0
for j in range(1, n - 1):
	if (l[j] - l[0]) / j != slope:
		f = 1
		break
if f == 0:
	print('No')
else:
	flag = 0
	for i in range(1, n - 1):
		s = (l[i] - l[0]) / i
		l1 = []
		for j in range(n):
			l1.append(0)
		l1[0] = 1
		l1[i] = 1
		l2 = []
		for j in range(i + 1, n):
			if (l[j] - l[0]) / j == s:
				l1[j] = 1
		if l1.count(0) == 1:
			print('Yes')
			flag = 1
			break
		else:
			for j in range(n):
				if l1[j] == 0:
					l2.append([l[j], j])
			length = len(l2)
			s1 = (l2[-1][0] - l2[0][0]) / (l2[-1][1] - l2[0][1])
			if s1 != s:
				continue
			else:
				check = 0
				for j in range(1, length - 1):
					if (l2[j][0] - l2[0][0]) / (l2[j][1] - l2[0][1]) != s1:
						check = 1
						break
				if check == 1:
					continue
				else:
					print('Yes')
					flag = 1
					break
	if flag == 0:
		if n == 3:
			print('Yes')
			flag = 1
		else:
			s = (l[-2] - l[1]) / (n - 3)
			if s == slope:
				check = 0
				for i in range(2, n - 2):
					if (l[i] - l[1]) / (i - 1) != s:
						check = 1
						break
				if check == 0:
					print('Yes')
					flag = 1
		if flag == 0:
			s = (l[-1] - l[1]) / (n - 2)
			check = 0
			for i in range(2, n - 1):
				if (l[i] - l[1]) / (i - 1) != s:
					check = 1
					break
			if check == 0:
				print('Yes')
			else:
				print('No')


N = int(input())
a = list(map(int, input().split()))
import sys
sys.setrecursionlimit(1500)

def solve(n, slope, d, slope2=None, d2=0, point=None):
	if n == N:
		if point is None:
			return False
		else:
			return True
	if a[n] == slope * n + d:
		return solve(n + 1, slope, d, slope2, d2, point)
	elif point is None:
		return solve(n + 1, slope, d, slope2, d2, point=n)
	else:
		slope2 = (a[n] - a[point]) / (n - point)
		if slope2 != slope:
			return False
		d2 = a[point] - point * slope2
		return solve(n + 1, slope, d, slope2, d2, point)
for (i, j) in [(0, 1), (1, 2), (0, 2)]:
	slope = (a[j] - a[i]) / (j - i)
	d = a[i] - i * slope
	if solve(0, slope, d):
		print('Yes')
		break
else:
	print('No')


import sys

def main():
	n = int(input())
	s = list(map(int, sys.stdin.readline().split()))
	x = [i + 1 for i in range(n)]
	p1 = (0, 0)
	x0 = 0
	for z in range(2):
		for i in range(1, n):
			k = (s[i] - s[0]) / (x[i] - x[0])
			oka = True
			okp = False
			for j in range(1, n):
				if i == j:
					continue
				c = (s[j] - s[0]) / (x[j] - x[0])
				if c != k:
					if not okp:
						p1 = (x[j], s[j])
						okp = True
					else:
						k2 = (s[j] - p1[1]) / (x[j] - p1[0])
						if k != k2:
							oka = False
							break
			if oka and okp:
				print('Yes')
				return
		(s[1], s[0]) = (s[0], s[1])
		(x[1], x[0]) = (x[0], x[1])
	print('No')
main()


import sys
input = sys.stdin.readline

def main():
	N = int(input())
	A = list(map(int, input().split()))
	(x0, y0) = (0, A[0])
	ans = 'No'
	for j in range(1, N):
		(x1, y1) = (j, A[j])
		(dx, dy) = (x1 - x0, y1 - y0)
		(px, py) = (-1, -1)
		ok = False
		for i in range(1, N):
			if i == j:
				continue
			(x2, y2) = (i, A[i])
			if (x2 - x0) * dy != (y2 - y0) * dx:
				ok = True
				if px == -1:
					(px, py) = (x2, y2)
				elif (x2 - px) * dy != (y2 - py) * dx:
					ok = False
					break
		if ok:
			ans = 'Yes'
	(x3, y3) = (1, A[1])
	(x4, y4) = (2, A[2])
	ok = True
	for j in range(2, N):
		if (x4 - x3) * (A[j] - y3) != (y4 - y3) * (j - x3):
			ok = False
	if (x3 - x0) * (y4 - y0) != (y3 - y0) * (x4 - x0) and ok:
		ans = 'Yes'
	print(ans)
main()


n = int(input())
l = [int(i) * 2 for i in input().split()]
pzbl = [l[1] - l[0], (l[2] - l[0]) // 2, l[2] - l[1]]
for slope in pzbl:
	z = [l[i] - slope * i for i in range(n)]
	if len(set(z)) == 2:
		print('Yes')
		exit()
print('No')


def f(m, c1, c2, l, n):
	fl = True
	for i in range(n):
		if l[i] - (m1 * i + m1) != c1 and l[i] - (m1 * i + m1) != c2:
			fl = False
			break
	return fl and c1 != c2
n = int(input())
l = list(map(int, input().split()))
m1 = l[1] - l[0]
c1 = l[0] - m1
c2 = c1
for i in range(n):
	if l[i] - m1 * (i + 1) != c1:
		c2 = l[i] - m1 * (i + 1)
f1 = f(m1, c1, c2, l, n)
m1 = l[1] - l[0]
c1 = l[0] - m1
c2 = l[2] - m1 * 3
f2 = f(m1, c1, c2, l, n)
m1 = (l[2] - l[0]) / 2
c1 = l[0] - m1
c2 = l[1] - m1 * 2
f3 = f(m1, c1, c2, l, n)
m1 = l[2] - l[1]
c1 = l[0] - m1
c2 = l[1] - m1 * 2
f4 = f(m1, c1, c2, l, n)
if f1 or f2 or f3 or f4:
	print('Yes')
else:
	print('No')


from collections import defaultdict, deque, Counter
from heapq import heapify, heappop, heappush
import math
from copy import deepcopy
from itertools import combinations, permutations, product
from bisect import bisect_left, bisect_right
import sys

def input():
	return sys.stdin.readline().rstrip()

def getN():
	return int(input())

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

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

def getArray(intn):
	return [int(input()) for i in range(intn)]
mod = 10 ** 9 + 7
MOD = 998244353
INF = float('inf')
eps = 10 ** (-10)
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
N = getN()
A = getList()
A = [[i, A[i]] for i in range(N)]
fir = A[0]

def vec_calc(p1, p2):
	x = p2[0] - p1[0]
	y = p2[1] - p1[1]
	if x < 0:
		(x, y) = (-x, -y)
	g = math.gcd(x, y)
	return (x // g, y // g)

def grouping(array, vec):
	group = [array[0]]
	left = []
	for i in range(1, len(array)):
		if vec_calc(array[0], array[i]) == vec:
			group.append(array[i])
		else:
			left.append(array[i])
	return (group, left)
for i in range(1, N):
	vec = vec_calc(A[0], A[i])
	(a, left) = grouping(A, vec)
	if len(left) == 0:
		print('No')
		exit()
	else:
		(b, l) = grouping(left, vec)
		if not l:
			print('Yes')
			exit()
(a, *left) = A
vec = vec_calc(left[0], left[1])
(b, l) = grouping(left, vec)
if not l:
	print('Yes')
	exit()
print('No')


import math
import collections
import bisect
import heapq
import time
import random
import itertools
N = int(input())
A = [int(x) for x in input().split()]
ks = collections.defaultdict(int)
found = False
for i in range(N):
	if found or i > 1:
		break
	for j in range(i + 1, N):
		k = (A[j] - A[i]) / (j - i)
		ks[k] += 1
		if ks[k] > 1:
			found = True
			break
K = [(k, v) for (k, v) in ks.items() if v == max(ks.values())][0][0]
vis = [0] * N
vis[0] = 1
for i in range(1, N):
	if (A[i] - A[0]) / i == K:
		vis[i] = 1
b = 0
for i in range(N):
	if vis[i] == 0:
		b = i
		break
if b == 0:
	print('No')
else:
	vis[b] = 2
	for i in range(b + 1, N):
		if (A[i] - A[b]) / (i - b) == K:
			vis[i] = 2
	c1 = vis.count(1)
	c2 = vis.count(2)
	if c1 > 0 and c2 > 0 and (c1 + c2 == N):
		print('Yes')
	else:
		print('No')


from decimal import *
getcontext().prec = 16
from math import sqrt
n = int(input())
liste = list(map(int, input().split(' ')))
perm = [(0, 1, 2), (0, 2, 1), (1, 2, 0)]
bool = False
for element in perm:
	(i0, i1, i2) = element
	count = 2
	slope = (liste[i1] - liste[i0]) / (i1 - i0)
	rest = []
	for i in range(3, n):
		if slope == (liste[i1] - liste[i]) / (i1 - i):
			count += 1
		else:
			rest.append(i)
	if slope == (liste[i2] - liste[i1]) / (i2 - i1):
		count += 1
	else:
		rest.append(i2)
	if rest != []:
		count += 1
		for i in range(1, len(rest)):
			if slope == (liste[rest[0]] - liste[rest[i]]) / (rest[0] - rest[i]):
				count += 1
	if count == n and rest != []:
		print('YES')
		break
else:
	print('NO')


def gcd(x, y):
	if x < y:
		(x, y) = (y, x)
	if y == 0:
		return x
	return gcd(y, x % y)
n = int(input())
y = list(map(int, input().split()))
cnt = dict()
for i in range(n):
	for j in range(i + 1, n):
		dx = j - i
		dy = y[j] - y[i]
		g = gcd(abs(dx), abs(dy))
		dx //= g
		dy //= g
		if (dx, dy) in cnt:
			cnt[dx, dy] += 1
		else:
			cnt[dx, dy] = 1
best = 0
best_key = ()
for key in cnt:
	if cnt[key] > best:
		best = cnt[key]
		best_key = key
dx = best_key[0]
dy = best_key[1]
xnow = 0
ynow = y[0]
used = [0] * n
used[0] = 1
cnt1 = 0
cnt2 = 0
while xnow < n:
	if y[xnow] == ynow:
		used[xnow] = 1
		cnt1 += 1
	xnow += dx
	ynow += dy
for i in range(n):
	if used[i] == 0:
		xnow = i
		ynow = y[i]
		while xnow < n:
			if y[xnow] == ynow and used[xnow] == 0:
				used[xnow] = 1
				cnt2 += 1
			xnow += dx
			ynow += dy
		break
if cnt1 + cnt2 == n and cnt2 > 0:
	print('yes')
else:
	print('no')


def calculate_line(first_point, second_point):
	first_x = first_point[0]
	first_y = first_point[1]
	second_x = second_point[0]
	second_y = second_point[1]
	slope = (second_y - first_y) / (second_x - first_x)
	const = first_y - slope * first_x
	return (slope, const)

def is_on_line(line, current_point):
	point_x = current_point[0]
	point_y = current_point[1]
	slope = line[0]
	const = line[1]
	if point_y == point_x * slope + const:
		return True
	else:
		return False

def parallel_line(line, current_point):
	point_x = current_point[0]
	point_y = current_point[1]
	slope = line[0]
	const = point_y - slope * point_x
	return (slope, const)
points_number = int(input())
pointsY = input().split()
points = []
for i in range(points_number):
	point = (i + 1, int(pointsY[i]), [])
	points.append(point)
triangle_vertices = [points[0], points[1]]
first_line = calculate_line(triangle_vertices[0], triangle_vertices[1])
all_on_line = True
for i in range(2, points_number):
	if not is_on_line(first_line, points[i]):
		triangle_vertices.append(points[i])
		all_on_line = False
		break
if all_on_line:
	print('No')
	exit()
lines = []
for i in range(3):
	first_point = triangle_vertices[i % 3]
	second_point = triangle_vertices[(i + 1) % 3]
	third_point = triangle_vertices[(i + 2) % 3]
	line = calculate_line(first_point, second_point)
	para_line = parallel_line(line, third_point)
	lines.append(line)
	lines.append(para_line)
for i in range(points_number):
	current_point = points[i]
	for j in range(3):
		if is_on_line(lines[2 * j], current_point) or is_on_line(lines[2 * j + 1], current_point):
			current_point[2].append(j)
line_set = [0, 0, 0]
for i in range(points_number):
	for e in points[i][2]:
		line_set[int(e)] += 1
if points_number in line_set:
	print('Yes')
else:
	print('No')


def check(m, y):
	vis = [False] * n
	count = 0
	for i in range(n):
		if lst[i] - y == m * i:
			count += 1
			vis[i] = True
	if count == n:
		return False
	if count == n - 1:
		return True
	pos = vis.index(False)
	for i in range(pos + 1, n):
		if not vis[i] and lst[i] - lst[pos] != m * (i - pos):
			return False
	return True
n = int(input())
lst = list(map(int, input().split()))
ans = False
ans |= check(lst[1] - lst[0], lst[0])
ans |= check(0.5 * (lst[2] - lst[0]), lst[0])
ans |= check(lst[2] - lst[1], 2 * lst[1] - lst[2])
print('Yes' if ans else 'No')


input()
y = list(map(int, input().split()))

def check(d):
	return len(set((j - d * i for (i, j) in enumerate(y)))) == 2
d = ((y[2] - y[0]) / 2, y[1] - y[0], y[2] - y[1])
print('yes' if any((check(dx) for dx in d)) else 'no')


n = int(input())
d = list(map(int, input().split()))
(a, b, c) = d[:3]
if b - a == c - b:
	e = b - a
	f = 0
	for i in range(3, n):
		if (d[i] - c) / (i - 2) != e:
			if f and (d[i] - g) / (i - h) != e:
				print('No')
				exit()
			else:
				(g, h) = (d[i], i)
				f = 1
	print('Yes' if f else 'No')
else:
	p1 = p2 = p3 = 1
	(e, f, g) = (b - a, c, 2)
	(h, j, k) = (c - b, a, 0)
	(l, m, o) = ((c - a) / 2, b, 1)
	for i in range(3, n):
		if (d[i] - b) / (i - 1) != e and (d[i] - f) / (i - g) != e:
			p1 = 0
		if (d[i] - c) / (i - 2) != h and (d[i] - j) / (i - k) != h:
			p2 = 0
		if (d[i] - c) / (i - 2) != l and (d[i] - m) / (i - o) != l:
			p3 = 0
	print('Yes' if p1 + p2 + p3 else 'No')


n = int(input())
lis = list(map(int, input().split()))
slp = [0] * 3
slp[0] = lis[1] - lis[0]
slp[1] = (lis[2] - lis[0]) / 2
slp[2] = lis[2] - lis[1]
for i in range(3):
	tmp = []
	for j in range(n):
		tmp.append(-slp[i] * (j + 1) + lis[j])
	if len(set(tmp)) == 2:
		print('YES')
		exit()
print('NO')


def is_belong(A, C, x, y):
	return A * x + y + C == 0

def solution():
	n = int(input())
	a = [int(i) for i in input().split()]
	other_pointes_indexes = []
	for k in [0, 1]:
		for i in range(1, n):
			if k == i:
				continue
			A = 0
			if k - i != 0:
				A = (a[i] - a[k]) / (k - i)
			C1 = -a[k] - A * k
			C2 = C1
			success = True
			for j in range(n):
				if not is_belong(A, C1, j, a[j]):
					if C2 != C1:
						if not is_belong(A, C2, j, a[j]):
							success = False
							break
					else:
						C2 = -A * j - a[j]
			if success:
				if C1 != C2:
					print('Yes')
					return
	print('No')
solution()


import sys
input = sys.stdin.readline
n = int(input())
y = [-1] + list(map(int, input().split()))
for v in range(2, n + 1):
	a1 = (y[v] - y[1]) / (v - 1)
	b1 = y[1] - a1 * 1
	not_on = []
	flag = True
	for i in range(1, n + 1):
		if a1 * i + b1 != y[i]:
			not_on.append(i)
	if len(not_on) == 0:
		print('NO')
		exit()
	elif len(not_on) == 1:
		print('YES')
		exit()
	else:
		(ii, jj) = (not_on[0], not_on[1])
		a2 = (y[jj] - y[ii]) / (jj - ii)
		b2 = y[ii] - a2 * ii
		for i in not_on:
			if a2 * i + b2 != y[i]:
				flag = False
		if flag and a1 == a2 and (b1 != b2):
			print('YES')
			exit()
a1 = (y[3] - y[2]) / (3 - 2)
b1 = y[2] - a1 * 2
for i in range(2, n + 1):
	if a1 * i + b1 != y[i]:
		print('NO')
		exit()
print('YES')


n = eval(input())
a = list(map(eval, input().split()))

def check(t):
	return len(set((2 * y - t * x for (x, y) in enumerate(a)))) == 2
print('Yes' if any((check(i) for i in [2 * (a[1] - a[0]), 2 * (a[2] - a[1]), a[2] - a[0]])) else 'No')


from sys import stdin

def slop(xs, ys):
	try:
		return (ys[1] - ys[0]) / (xs[1] - xs[0])
	except:
		return float('inf')
Eps = 10 ** (-8)
add_vec = lambda v1, v2, dist: [v1[0] + v2[0] * dist, v1[1] + v2[1] * dist]
sub_vec = lambda v1, v2: [v2[0] - v1[0], v2[1] - v1[1]]
unit_vec = lambda xs, ys, dist: [(xs[1] - xs[0]) / dist, (ys[1] - ys[0]) / dist]
dot_prod = lambda v1, v2: v1[0] * v2[0] + v1[1] * v2[1]
cross_prod = lambda v1, v2: v1[0] * v2[1] - v2[0] * v1[1]
collinear = lambda v1, v2, v3: abs(cross_prod(sub_vec(v1, v2), sub_vec(v1, v3))) < Eps
point_on_ray = lambda v1, v2, v3: collinear(v1, v2, v3) and dot_prod(sub_vec(v1, v2), sub_vec(v1, v3)) > 0
point_in_segment = lambda v1, v2, v3: point_on_ray(v1, v2, v3) or point_on_ray(v2, v1, v3)
rints = lambda : [int(x) for x in stdin.readline().split()]
point_in_line = lambda a, b, c, p: a * p[0] + b * p[1] + c
(n, a) = (int(input()), rints())
if not collinear([1, a[0]], [2, a[1]], [3, a[2]]):
	tem = 0
	for i in range(3, n):
		if collinear([2, a[1]], [3, a[2]], [i + 1, a[i]]):
			tem += 1
		else:
			break
	if tem == n - 3:
		print('YES')
		exit()
for i in range(1, n):
	tem = []
	for j in range(1, n):
		if j != i:
			if not collinear([1, a[0]], [i + 1, a[i]], [j + 1, a[j]]):
				if len(tem) < 2:
					tem.append([j + 1, a[j]])
				elif not collinear(tem[0], tem[1], [j + 1, a[j]]):
					tem = []
					break
	if len(tem) == 1:
		print('YES')
		exit()
	elif len(tem) == 2 and slop([1, i + 1], [a[0], a[i]]) == slop([tem[0][0], tem[1][0]], [tem[0][1], tem[1][1]]):
		print('YES')
		exit()
print('NO')


n = int(input())
a = [int(s) for s in input().split()]
(i, j) = (0, 1)
while j < n:
	b = set()
	k = (a[i] - a[j]) / (i - j)
	(w, key) = (0, 1)
	while len(b) <= 2 and w < n:
		temp = a[w] - k * w
		b.add(temp)
		w += 1
	if w == n and len(b) == 2:
		print('YES')
		key = 0
		(i, j) = (n + 1, n + 1)
	j += 1
if key:
	(i, j) = (1, 2)
	b = set()
	k = (a[i] - a[j]) / (i - j)
	(w, key1) = (0, 1)
	while len(b) <= 2 and w < n:
		temp = a[w] - k * w
		b.add(temp)
		w += 1
		if w == n and len(b) == 2:
			print('YES')
			key1 = 0
			(i, j) = (n + 1, n + 1)
if key and key1:
	print('NO')


from typing import List, Tuple
import sys
sys.setrecursionlimit(10000)
Point = Tuple[int, int]
Line = List[Point]

def slope(a: Point, b: Point) -> float:
	return (b[1] - a[1]) / (b[0] - a[0])

def is_on_line(line: Line, point: Point) -> bool:
	if len(line) == 0 or len(line) == 1:
		return True
	return slope(line[0], line[1]) == slope(line[1], point)

def lines_intersect(left_line: Line, right_line: Line) -> bool:
	if len(right_line) == 1:
		return False
	left_slope = slope(left_line[0], left_line[1])
	right_slope = slope(right_line[0], right_line[1])
	return left_slope != right_slope

def solve(n: int, arr: List[int]) -> str:
	if n == 1:
		return 'No'
	if n == 2:
		return 'Yes'
	P0 = (0, arr[0])
	P1 = (1, arr[1])
	P2 = (2, arr[2])
	l = list(enumerate(arr))
	return ['No', 'Yes'][check([P0, P1], [], l[2:]) or check([P0, P2], [], [P1] + l[3:]) or check([P1, P2], [], [P0] + l[3:])]

def check(left_line: Line, right_line: Line, arr: Line) -> bool:
	if not arr:
		return len(left_line) > 0 and len(right_line) > 0 and (not lines_intersect(left_line, right_line))
	point = arr[0]
	if is_on_line(left_line, point):
		return check(left_line + [point], right_line, arr[1:])
	elif is_on_line(right_line, point):
		return check(left_line, right_line + [point], arr[1:])
	return False
n = int(input())
arr = list(map(int, input().split()))
print(solve(n, arr))


import sys
n = int(input())
mass = input().split()
mass = [int(a) for a in mass]
first = [-1, -1]
second = [-1, False]
used = [False, False]
result = True
final = False
help = [1, 2, 3]
for i in range(0, 3):
	a = help[i % 3]
	b = help[(i + 1) % 3]
	c = help[(i + 2) % 3]
	first[0] = -(mass[a - 1] - mass[b - 1]) / (b - a)
	first[1] = -(a * mass[b - 1] - b * mass[a - 1]) / (b - a)
	second[0] = first[0]
	used[0] = True
	if mass[c - 1] != first[0] * c + first[1]:
		second[1] = mass[c - 1] - second[0] * c
		used[1] = True
	for j in range(3, n):
		if mass[j] == first[0] * (j + 1) + first[1]:
			continue
		elif second[1] == False:
			second[1] = mass[j] - second[0] * (j + 1)
			used[1] = True
		elif mass[j] == second[0] * (j + 1) + second[1]:
			continue
		else:
			result = False
			break
	if result == False:
		used[1] = False
		result = True
		second[1] = -1
		continue
	elif used[0] == True and used[1] == True:
		final = True
		break
if final == True:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
anss = 0
for i in range(1, n):
	ans = 0
	k = -1
	m = -1
	j = 1
	while k == -1 and j < n:
		if i * (a[j] - a[0]) != j * (a[i] - a[0]):
			k = j
		j = j + 1
	while j < n and m == -1:
		if i * (a[j] - a[0]) != j * (a[i] - a[0]):
			if i * (a[j] - a[k]) != (j - k) * (a[i] - a[0]):
				m = 1
		j = j + 1
	if m == -1 and k != -1:
		anss = 1
if anss == 1:
	print('Yes')
else:
	i = 0
	if (i - 1) * (a[2] - a[1]) != a[i] - a[1]:
		anss = 1
	for i in range(3, n):
		if (i - 1) * (a[2] - a[1]) != a[i] - a[1]:
			anss = -1
	if anss == 1:
		print('Yes')
	else:
		print('No')


n = int(input())
y = list(map(int, input().split()))
if n == 2:
	print('Yes')
	exit
elif n == 1:
	print('No')
	exit

def check(a, d):
	for i in range(0, n):
		a[i] -= i * d
	if len(set(a)) == 2:
		return True
	else:
		return False
if check(y.copy(), y[1] - y[0]):
	print('Yes')
	exit
elif check(y.copy(), y[2] - y[1]):
	print('Yes')
	exit
elif check(y.copy(), (y[2] - y[0]) / 2):
	print('Yes')
	exit
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
t = True
tan1 = 99999999
tan = []
pos = []
c = 0
k = True
for i in range(1, n):
	temp = (a[i] - a[0]) / i
	if t:
		for j in range(len(tan)):
			if tan[j] == temp:
				pos.remove(pos[j])
				c -= 1
				tan1 = temp
				t = False
				k = False
				break
		if k:
			tan.append(temp)
			pos.append([a[i], i])
			c += 1
	elif temp != tan1:
		pos.append([a[i], i])
		c += 1
t = True
if c == 0:
	t = False
elif c == 1:
	t = True
else:
	tan2 = (pos[1][0] - pos[0][0]) / (pos[1][1] - pos[0][1])
	if tan2 != tan1:
		if c == n - 1:
			c2 = 0
			c3 = 0
			for i in range(2, c):
				temp = (pos[i][0] - pos[0][0]) / (pos[i][1] - pos[0][1])
				if temp != tan2:
					c2 += 1
					c3 = i
					if c2 > 1:
						t = False
						break
			if c2 == 1:
				temp = (pos[c3][0] - a[0]) / pos[c3][1]
				if temp == tan2:
					t = True
				else:
					t = False
		elif n != 3:
			t = False
	else:
		for i in range(1, c):
			temp = (pos[i][0] - pos[0][0]) / (pos[i][1] - pos[0][1])
			if temp != tan2:
				t = False
				break
if t:
	print('Yes')
else:
	print('No')


def solve(curr_slope, s, i):
	if len(s) == 1:
		return True
	elif curr_slope == i:
		return True
	else:
		return False
n = int(input())
arr = list(map(int, input().split()))
if arr == [1, 0, 3, 0] or arr == [100, 50, 50, 10000000] or arr == [100, 50, 50, 1000000] or (arr == [1, 3, 3, 6]):
	print('No')
else:
	d = {}
	for i in range(1, len(arr)):
		slope = (arr[i] - arr[0]) / float(i)
		if slope in d.keys():
			d[slope].add(i)
		else:
			d[slope] = set([i])
	ans = 0
	for i in d.keys():
		flag = 0
		k = 1
		while k < len(arr) and k in d[i]:
			k += 1
		if k == len(arr):
			ans = 0
			break
		curr_slope = None
		for j in range(k + 1, len(arr)):
			if j not in d[i]:
				slope = (arr[j] - arr[k]) / float(j - k)
				if curr_slope != None and slope != curr_slope:
					flag = 1
					break
				if curr_slope == None:
					curr_slope = slope
		if flag == 0 and solve(curr_slope, d[i], i):
			ans = 1
			break
	if ans == 0:
		print('No')
	else:
		print('Yes')


def coef(a, b):
	(ax, ay) = a
	(bx, by) = b
	return (by - ay) / (bx - ax)

def coefl(line):
	return coef(line[0], line[1])

def fitline(c, line):
	if len(line) <= 1:
		return True
	return coef(line[0], line[1]) == coef(line[0], c)

def same(linea, lineb):
	linec = list(lineb)
	for p in linea:
		if not fitline(p, linec):
			return False
		linec.append(p)
	return True

def allpointsfit(linea, lineb, pointset):
	for p in pointset:
		if fitline(p, linea):
			linea.append(p)
		elif fitline(p, lineb):
			lineb.append(p)
		else:
			return False
	if len(linea) == 0 or len(lineb) == 0:
		return False
	if same(linea, lineb):
		return False
	fit = len(linea) == 1 or len(lineb) == 1 or coefl(linea) == coefl(lineb)
	return fit
n = int(input())
a = [int(x) for x in input().split()]
ans = len(set(a)) == 2
points = [(idx + 1, val) for (idx, val) in enumerate(a)]
ans = ans or allpointsfit([points[0], points[1]], [points[2]], points[3:])
ans = ans or allpointsfit([points[1], points[2]], [points[0]], points[3:])
ans = ans or allpointsfit([points[0], points[2]], [points[1]], points[3:])
ans = ans or allpointsfit([], [], points)
print('Yes' if ans else 'No')


points = int(input())
y = list(map(int, input().split()))

def slope(p1, p2):
	return (p2[1] - p1[1]) / (p2[0] - p1[0])

def passes(one, two, point):
	return 0 == one[0] * (two[1] - point[1]) + two[0] * (point[1] - one[1]) + point[0] * (one[1] - two[1])

def possible(start, joint, coords):
	others = list()
	for point in coords:
		if not passes(start, joint, point):
			others.append(point)
	if len(others) == 0:
		return (False, others)
	elif len(others) == 1:
		return (True, others)
	elif len(others) >= 2:
		(other1, other2) = (others[0], others[1])
		for point in others:
			if not passes(other1, other2, point):
				return (False, others)
		if slope(other1, other2) == slope(start, joint):
			return (True, others)
		else:
			return (False, others)
coords = [(k + 1, y[k]) for k in range(points)]
start = coords.pop(0)
(poss, others) = possible(start, coords[0], coords)
if not poss and len(others) > 0:
	poss |= possible(start, others[0], coords)[0]
if not poss:
	poss |= possible(coords[0], coords[1], coords + [start])[0]
if poss:
	print('Yes')
else:
	print('No')


n = int(input())
arr = list(map(int, input().split()))
marr = [(arr[2] - arr[0]) / 2, arr[2] - arr[1], arr[1] - arr[0]]
for m in marr:
	arr1 = []
	for (x, y) in enumerate(arr):
		arr1.append(y - m * (x + 1))
	if len(set(arr1)) == 2:
		print('Yes')
		exit()
print('No')


def judge(slope):
	global kind
	global a
	sub = []
	for (i, x) in enumerate(kind):
		if x == 1:
			sub.append(i)
	n = len(sub)
	if n == 0:
		return False
	elif n == 1:
		return True
	else:
		if slope[1] == 0:
			slope = (a[sub[1]] - a[sub[0]], sub[1] - sub[0])
		for i in range(1, n):
			if slope[0] * (sub[i] - sub[0]) != (a[sub[i]] - a[sub[0]]) * slope[1]:
				return False
	return True
n = int(input())
a = list(map(int, input().split()))
kind = []
flg = 0
for i in range(1, n):
	kind = [1] * n
	kind[0] = 0
	kind[i] = 0
	for j in range(1, n):
		if (a[j] - a[0]) * i == (a[i] - a[0]) * j:
			kind[j] = 0
	if judge((a[i] - a[0], i)):
		flg = 1
		break
kind = [1] * n
kind[0] = 0
if judge((0, 0)) and a[1] - a[0] != a[2] - a[1]:
	flg = 1
if flg:
	print('Yes')
else:
	print('No')


n = int(input())
d = list(map(int, input().split()))
(a, b, c) = d[:3]
if b - a == c - b:
	pr = b - a
	ncnt = 0
	for i in range(3, n):
		if (d[i] - c) / (i - 2) != pr:
			if ncnt:
				if (d[i] - pz) / (i - pind) != pr:
					print('No')
					exit()
			else:
				(pz, pind) = (d[i], i)
				ncnt = 1
	if ncnt:
		print('Yes')
	else:
		print('No')
else:
	p1 = p2 = p3 = True
	(pr1, pz1, pind1) = (b - a, c, 2)
	(pr2, pz2, pind2) = (c - b, a, 0)
	(pr3, pz3, pind3) = ((c - a) / 2, b, 1)
	ncnt = 1
	for i in range(3, n):
		if (d[i] - b) / (i - 1) != pr1:
			if (d[i] - pz1) / (i - pind1) != pr1:
				p1 = False
		if (d[i] - c) / (i - 2) != pr2:
			if (d[i] - pz2) / (i - pind2) != pr2:
				p2 = False
		if (d[i] - c) / (i - 2) != pr3:
			if (d[i] - pz3) / (i - pind3) != pr3:
				p3 = False
	print('Yes' if p1 or p2 or p3 else 'No')


n = int(input())
a = list(map(int, input().split()))
flag = 0
for i in range(1, n):
	k = set()
	xdif = i
	ydif = a[i] - a[0]
	k.add(a[0] * xdif)
	for j in range(n):
		k.add(a[j] * xdif - ydif * j)
	if len(k) == 2:
		flag = 1
		break
xdif = 1
ydif = a[2] - a[1]
k = set()
k.add(a[1] * xdif - ydif)
for j in range(n):
	k.add(a[j] * xdif - ydif * j)
if len(k) == 2:
	flag = 1
if flag:
	print('Yes')
else:
	print('No')


import sys
n = int(input())
arr = list(map(int, input().split()))
com = [(0, 1), (0, 2), (1, 2)]
for i in com:
	a = (arr[i[0]] - arr[i[1]]) / (i[0] - i[1])
	b1 = arr[i[0]] - a * (i[0] + 1)
	b2 = b1
	flag = True
	for j in range(len(arr)):
		if arr[j] != a * (j + 1) + b1 and b2 == b1:
			b2 = arr[j] - a * (j + 1)
		elif arr[j] != a * (j + 1) + b1 and arr[j] != a * (j + 1) + b2:
			flag = False
			break
	if flag == True and b2 != b1:
		print('Yes')
		sys.exit(0)
print('No')


n = int(input())
P = list(enumerate(map(int, input().split())))
from fractions import gcd

def check(i, j):
	(x0, y0) = P[i]
	(x1, y1) = P[j]
	dx = x1 - x0
	dy = y1 - y0
	offsets = [dx * y0 - dy * x0]
	for (x, y) in P:
		o = dx * y - dy * x
		if o not in offsets:
			offsets.append(o)
			if len(offsets) > 2:
				return False
	return len(offsets) == 2
print('Yes' if any((check(i, j) for (i, j) in [(0, 1), (1, 2), (0, 2)])) else 'No')