You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct.

You may draw two straight lines (not necessarily distinct). Is it possible to do this in such a way that every point lies on at least one of these lines?


-----Input-----

The first line contains one integer n (1 ≤ n ≤ 10^5) — the number of points you are given.

Then n lines follow, each line containing two integers x_{i} and y_{i} (|x_{i}|, |y_{i}| ≤ 10^9)— coordinates of i-th point. All n points are distinct.


-----Output-----

If it is possible to draw two straight lines in such a way that each of given points belongs to at least one of these lines, print YES. Otherwise, print NO.


-----Examples-----
Input
5
0 0
0 1
1 1
1 -1
2 2

Output
YES

Input
5
0 0
1 0
2 1
1 1
2 3

Output
NO



-----Note-----

In the first example it is possible to draw two lines, the one containing the points 1, 3 and 5, and another one containing two remaining points. [Image]

Source: codeforces | Difficulty: HARD
Tags: Geometry


Solutions:
n = int(input())
import sys
pts = []
for i in range(n):
	(x, y) = map(int, input().split())
	pts.append([x, y])
if n <= 4:
	print('YES')
	sys.exit()
b1 = pts[0][0] - pts[1][0]
a1 = pts[1][1] - pts[0][1]
c1 = -a1 * pts[0][0] - b1 * pts[0][1]
a2 = 0
b2 = 0
c2 = 1
p = []
flag = True
for i in range(n):
	if a1 * pts[i][0] + b1 * pts[i][1] + c1 != 0 and a2 * pts[i][0] + b2 * pts[i][1] + c2 != 0:
		p.append(pts[i])
		if len(p) == 2:
			b2 = p[0][0] - p[1][0]
			a2 = p[1][1] - p[0][1]
			c2 = -a2 * p[0][0] - b2 * p[0][1]
		if len(p) > 2:
			flag = False
			break
if flag:
	print('YES')
	sys.exit()
P = p
p = [pts[0], P[0]]
b1 = p[0][0] - p[1][0]
a1 = p[1][1] - p[0][1]
c1 = -a1 * p[0][0] - b1 * p[0][1]
p = []
a2 = 0
b2 = 0
c2 = 1
flag = True
for i in range(n):
	if a1 * pts[i][0] + b1 * pts[i][1] + c1 != 0 and a2 * pts[i][0] + b2 * pts[i][1] + c2 != 0:
		p.append(pts[i])
		if len(p) == 2:
			b2 = p[0][0] - p[1][0]
			a2 = p[1][1] - p[0][1]
			c2 = -a2 * p[0][0] - b2 * p[0][1]
		if len(p) > 2:
			flag = False
			break
if flag:
	print('YES')
	sys.exit()
p = [P[0], pts[1]]
b1 = p[0][0] - p[1][0]
a1 = p[1][1] - p[0][1]
c1 = -a1 * p[0][0] - b1 * p[0][1]
p = []
a2 = 0
b2 = 0
c2 = 1
flag = True
for i in range(n):
	if a1 * pts[i][0] + b1 * pts[i][1] + c1 != 0 and a2 * pts[i][0] + b2 * pts[i][1] + c2 != 0:
		p.append(pts[i])
		if len(p) == 2:
			b2 = p[0][0] - p[1][0]
			a2 = p[1][1] - p[0][1]
			c2 = -a2 * p[0][0] - b2 * p[0][1]
		if len(p) > 2:
			flag = False
			break
if flag:
	print('YES')
	sys.exit()
print('NO')


def colinear(p1, p2, p3):
	return p1[0] * (p2[1] - p3[1]) + p2[0] * (p3[1] - p1[1]) + p3[0] * (p1[1] - p2[1]) == 0

def create_options(points):
	p0 = points[0]
	p1 = points[1]
	p2 = points[2]
	p3 = points[3]
	if colinear(p0, p1, p2) and colinear(p1, p2, p3):
		return ([(p0, p1), []], 3)
	elif colinear(p0, p1, p2):
		return ([(p0, p1), [p3]], 3)
	elif colinear(p0, p1, p3):
		return ([(p0, p1), [p2]], 3)
	elif colinear(p0, p2, p3):
		return ([(p0, p2), [p1]], 3)
	elif colinear(p1, p2, p3):
		return ([(p1, p2), [p0]], 3)
	else:
		p4 = points[4]
		if colinear(p0, p1, p4):
			return ([(p0, p1), [p2, p3]], 4)
		elif colinear(p0, p2, p4):
			return ([(p0, p2), [p1, p3]], 4)
		elif colinear(p0, p3, p4):
			return ([(p0, p3), [p1, p2]], 4)
		elif colinear(p1, p2, p4):
			return ([(p1, p2), [p0, p3]], 4)
		elif colinear(p1, p3, p4):
			return ([(p1, p3), [p0, p2]], 4)
		elif colinear(p2, p3, p4):
			return ([(p2, p3), [p0, p1]], 4)
	return (False, 4)

def solution(points):
	if len(points) <= 4:
		return True
	(options, last) = create_options(points)
	if not options:
		return False
	for p in points[last + 1:]:
		if not colinear(options[0][0], options[0][1], p):
			if len(options[1]) < 2:
				options[1].append(p)
			elif not colinear(options[1][0], options[1][1], p):
				return False
	return True
n = int(input())
points = [tuple(map(int, input().split())) for _ in range(n)]
print('YES' if solution(points) else 'NO')


from itertools import combinations
ps = [tuple(map(int, input().split())) for ln in range(int(input()))]

def outside(pt, v1, v2):
	return (pt[0] - v2[0]) * (v1[1] - v2[1]) - (pt[1] - v2[1]) * (v1[0] - v2[0])

def oneline(ps):
	return len(ps) <= 2 or not [p for p in ps if outside(p, ps[0], ps[1])]
if len(ps) <= 4:
	print('YES')
else:
	vs = (ps[:2] + [p for p in ps if outside(p, *ps[:2])] + [ps[0]])[:3]
	print('YES' if any((oneline([p for p in ps if outside(p, v1, v2)]) for (v1, v2) in combinations(vs, 2))) else 'NO')


from sys import stdin, stdout

def pair_of_lines(n, xy_a):
	if len(xy_a) <= 3:
		return 'YES'
	(p1, p2, p3) = (xy_a[0], xy_a[1], xy_a[2])
	if judge(p1, kstr(p1, p2), xy_a):
		return 'YES'
	if judge(p1, kstr(p1, p3), xy_a):
		return 'YES'
	if judge(p2, kstr(p2, p3), xy_a):
		return 'YES'
	return 'NO'

def kstr(xy1, xy2):
	(cx, cy) = (xy1[0], xy1[1])
	(x, y) = (xy2[0], xy2[1])
	dx = x - cx
	dy = y - cy
	k = ''
	if dx == 0:
		k = str(x) + '/y'
	elif dy == 0:
		k = 'x/' + str(y)
	else:
		g = gcd(dx, dy)
		dx //= g
		dy //= g
		k = str(dx) + '/' + str(dy)
	return k

def judge(p, k, xy_a):
	rl = []
	for xy in xy_a:
		if p[0] == xy[0] and p[1] == xy[1]:
			continue
		if kstr(p, xy) != k:
			rl.append(xy)
	if len(rl) > 2:
		ck = kstr(rl[0], rl[1])
		for i in range(2, len(rl)):
			if ck != kstr(rl[0], rl[i]):
				return False
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
try:
	n = int(stdin.readline())
	xy_a = []
	for _ in range(n):
		xy_a.append(list(map(int, stdin.readline().split())))
	res = pair_of_lines(n, xy_a)
	stdout.write(res)
except Exception as e:
	print(e)


def ff(p, q, pp):
	npp = []
	for r in pp:
		if (p[1] - r[1]) * (p[0] - q[0]) != (p[1] - q[1]) * (p[0] - r[0]):
			npp.append(r)
	if len(npp) <= 2:
		return True
	a = npp[0]
	b = npp[1]
	for c in npp:
		if (a[1] - c[1]) * (a[0] - b[0]) != (a[1] - b[1]) * (a[0] - c[0]):
			return False
	return True
n = int(input())
if n <= 4:
	print('YES')
else:
	pp = []
	for _ in range(n):
		(a, b) = [int(x) for x in input().split()]
		pp.append((a, b))
	if ff(pp[0], pp[1], pp) or ff(pp[1], pp[2], pp) or ff(pp[0], pp[2], pp):
		print('YES')
	else:
		print('NO')


n = int(input())
if n <= 4:
	print('YES')
	exit()
A = [None] * n
for i in range(n):
	A[i] = list(map(int, input().split()))

def is_colinear(a1, a2, a3):
	if a1 == a2 or a2 == a3 or a1 == a3:
		return True
	(x1, y1) = a1
	(x2, y2) = a2
	(x3, y3) = a3
	if x1 == x2 or x1 == x3 or x2 == x3:
		return x1 == x2 == x3
	if y1 == y2 or y1 == y3 or y2 == y3:
		return y1 == y2 == y3
	return (y2 - y1) * (x3 - x1) == (y3 - y1) * (x2 - x1)
(X, Y, Z) = (A[0], A[1], A[2])

def good(X, Y):
	bad = []
	for i in range(n):
		if not is_colinear(X, Y, A[i]):
			bad.append(A[i])
	if len(bad) <= 2:
		return True
	(U, V) = (bad[0], bad[1])
	for i in range(len(bad)):
		if not is_colinear(U, V, bad[i]):
			return False
	return True
if good(X, Y) or good(Y, Z) or good(X, Z):
	print('YES')
	exit()
print('NO')
exit()


import sys
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	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
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')

def fxn(p, q):
	x = []
	for r in a:
		if (r[1] - p[1]) * (q[0] - p[0]) != (q[1] - p[1]) * (r[0] - p[0]):
			x.append(r)
	if len(x) <= 2:
		return True
	(rh, cp) = (x[0], x[1])
	for c in x:
		if (c[1] - rh[1]) * (cp[0] - rh[0]) != (cp[1] - rh[1]) * (c[0] - rh[0]):
			return False
	return True
n = int(input())
a = []
for _ in range(n):
	(x, y) = int_array()
	a.append((x, y))
if n < 5:
	print('YES')
elif fxn(a[0], a[1]) or fxn(a[0], a[2]) or fxn(a[1], a[2]):
	print('YES')
else:
	print('NO')


class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __str__(self):
		return '(' + str(self.x) + ', ' + str(self.y) + ')'

	def __sub__(self, other):
		return Point(self.x - other.x, self.y - other.y)

def cross(a, b):
	return a.x * b.y - b.x * a.y
n = int(input())
points = []
for _ in range(n):
	(x_, y_) = map(int, input().strip().split())
	p = Point(x_, y_)
	points.append(p)

def check(used):
	global n, points
	f = -1
	s = -1
	for i in range(n):
		if not used[i]:
			if f == -1:
				f = i
			elif s == -1:
				s = i
	if s == -1:
		return True
	for i in range(n):
		if not used[i]:
			if cross(points[f] - points[s], points[i] - points[f]) != 0:
				return False
	return True

def solve(a, b):
	global n, points
	used = [False] * n
	for i in range(n):
		if cross(a - b, points[i] - a) == 0:
			used[i] = True
	return check(used)

def solution():
	global points
	if len(points) <= 2:
		print('YES')
		return
	ans = False
	if solve(points[0], points[1]) or solve(points[0], points[2]) or solve(points[1], points[2]):
		ans = True
	if ans:
		print('YES')
	else:
		print('NO')
solution()


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
OnLine = lambda A, B, C, x, y: A * x + B * y + C == 0

def OffLine(A, B, C, nodes):
	res = []
	for i in nodes:
		if not OnLine(A, B, C, i[0], i[1]):
			res.append(i)
	return res
flag = False
if n < 5:
	print('YES')
	raise SystemExit
for comb in __import__('itertools').combinations([0, 1, 2], 2):
	(i, j) = (comb[0], comb[1])
	b = OffLine(a[j][1] - a[i][1], a[i][0] - a[j][0], a[j][0] * a[i][1] - a[i][0] * a[j][1], a)
	if len(b) < 3:
		print('YES')
		raise SystemExit
	if not OffLine(b[j][1] - b[i][1], b[i][0] - b[j][0], b[j][0] * b[i][1] - b[i][0] * b[j][1], b):
		print('YES')
		raise SystemExit
print('NO')


def f(ii, i0, i1):
	nonlocal xy
	rtn = []
	(x0, y0) = xy[i0]
	(x1, y1) = xy[i1]
	for i in ii:
		(xi, yi) = xy[i]
		if (xi - x0) * (yi - y1) != (xi - x1) * (yi - y0):
			rtn.append(i)
	return rtn

def g(i0, i1):
	nonlocal f, n
	ls = f(list(range(n)), i0, i1)
	if len(ls) <= 2:
		return -1
	else:
		rs = f(ls, ls[0], ls[-1])
		if len(rs) == 0:
			return -1
		else:
			return rs[0]
n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
ans = 'NO'
if n <= 4:
	ans = 'YES'
else:
	xy.sort()
	i = g(0, n - 1)
	if i < 0:
		ans = 'YES'
	elif g(0, i) < 0:
		ans = 'YES'
	elif g(n - 1, i) < 0:
		ans = 'YES'
print(ans)


def nod(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b

def point3(x1, y1, x2, y2, x3, y3):
	dy12 = x2 - x1
	dx12 = -(y2 - y1)
	dx13 = x3 - x1
	dy13 = y3 - y1
	if dx12 * dx13 + dy12 * dy13 == 0:
		return True
	else:
		return False
lstline = []
mas = list(map(int, input().split()))
n = mas[0]
if n <= 4:
	for j in range(n):
		mas = list(map(int, input().split()))
	print('YES')
else:
	lst5 = []
	for j in range(5):
		mas = list(map(int, input().split()))
		lst5 = lst5 + [[mas[0], mas[1]]]
	ok = True
	for i in range(3):
		for j in range(i + 1, 4, 1):
			for k in range(j + 1, 5, 1):
				if ok:
					if point3(lst5[i][0], lst5[i][1], lst5[j][0], lst5[j][1], lst5[k][0], lst5[k][1]):
						l1x1 = lst5[i][0]
						l1y1 = lst5[i][1]
						l1x2 = lst5[j][0]
						l1y2 = lst5[j][1]
						ok = False
	if ok == False:
		lstline = []
		for j in range(5):
			if not point3(l1x1, l1y1, l1x2, l1y2, lst5[j][0], lst5[j][1]):
				lstline = lstline + [[lst5[j][0], lst5[j][1]]]
	if ok:
		for j in range(n - 5):
			mas = list(map(int, input().split()))
		print('NO')
	else:
		res = 'YES'
		ok1 = True
		for j in range(n - 5):
			mas = list(map(int, input().split()))
			okey1 = point3(l1x1, l1y1, l1x2, l1y2, mas[0], mas[1])
			if ok1:
				if len(lstline) == 2:
					l2x1 = lstline[0][0]
					l2y1 = lstline[0][1]
					l2x2 = lstline[1][0]
					l2y2 = lstline[1][1]
					ok1 = False
					okey2 = point3(l2x1, l2y1, l2x2, l2y2, mas[0], mas[1])
					if not okey1 and (not okey2):
						res = 'NO'
				elif not okey1:
					lstline = lstline + [[mas[0], mas[1]]]
			elif not okey1:
				okey2 = point3(l2x1, l2y1, l2x2, l2y2, mas[0], mas[1])
				if not okey2:
					res = 'NO'
		print(res)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
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))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def main():
	n = int(input())
	a = []
	for i in range(n):
		a.append(list(map(int, input().split())))
	d = {}
	if n == 1:
		print('YES')
		return
	vis = [0] * n
	for i in range(1, n):
		num = abs(a[i][1] - a[0][1])
		den = abs(a[i][0] - a[0][0])
		k = 1
		k = gcd(num, den)
		num //= k
		den //= k
		if (a[i][1] - a[0][1]) * (a[i][0] - a[0][0]) < 0:
			num *= -1
		if (num, den) in d:
			d[num, den].append(i)
		else:
			d[num, den] = [i]
	maxx = 0
	for i in d.keys():
		if len(d[i]) > maxx:
			maxx = len(d[i])
			ki = i
	vis[0] = 1
	for i in d[ki]:
		vis[i] = 1
	t = []
	for i in range(n):
		if not vis[i]:
			t.append(i)
	f = 1
	if len(t) > 1:
		num = abs(a[t[0]][1] - a[t[1]][1])
		den = abs(a[t[0]][0] - a[t[1]][0])
		k = 1
		k = gcd(num, den)
		num //= k
		den //= k
		if (a[t[0]][1] - a[t[1]][1]) * (a[t[0]][0] - a[t[1]][0]) < 0:
			num *= -1
		m = (num, den)
		for i in range(2, len(t)):
			num = abs(a[t[i]][1] - a[t[0]][1])
			den = abs(a[t[i]][0] - a[t[0]][0])
			k = gcd(num, den)
			num //= k
			den //= k
			if (a[t[0]][1] - a[t[i]][1]) * (a[t[0]][0] - a[t[i]][0]) < 0:
				num *= -1
			if (num, den) != m:
				f = 0
	if f:
		print('YES')
	else:
		d = {}
		if n == 1:
			print('YES')
			return
		vis = [0] * n
		(a[0], a[1]) = (a[1], a[0])
		for i in range(1, n):
			num = abs(a[i][1] - a[0][1])
			den = abs(a[i][0] - a[0][0])
			k = 1
			k = gcd(num, den)
			num //= k
			den //= k
			if (a[i][1] - a[0][1]) * (a[i][0] - a[0][0]) < 0:
				num *= -1
			if (num, den) in d:
				d[num, den].append(i)
			else:
				d[num, den] = [i]
		maxx = 0
		for i in d.keys():
			if len(d[i]) > maxx:
				maxx = len(d[i])
				ki = i
		vis[0] = 1
		for i in d[ki]:
			vis[i] = 1
		t = []
		for i in range(n):
			if not vis[i]:
				t.append(i)
		f = 1
		if len(t) > 1:
			num = abs(a[t[0]][1] - a[t[1]][1])
			den = abs(a[t[0]][0] - a[t[1]][0])
			k = 1
			k = gcd(num, den)
			num //= k
			den //= k
			if (a[t[0]][1] - a[t[1]][1]) * (a[t[0]][0] - a[t[1]][0]) < 0:
				num *= -1
			m = (num, den)
			for i in range(2, len(t)):
				num = abs(a[t[i]][1] - a[t[0]][1])
				den = abs(a[t[i]][0] - a[t[0]][0])
				k = 1
				k = gcd(num, den)
				num //= k
				den //= k
				if (a[t[0]][1] - a[t[i]][1]) * (a[t[0]][0] - a[t[i]][0]) < 0:
					num *= -1
				if (num, den) != m:
					f = 0
		if f:
			print('YES')
		else:
			print('NO')
	return
main()


R = lambda : list(map(int, input().split()))
n = int(input())
ps = []

def ff(a, b):
	pp = []
	dy = b[1] - a[1]
	dx = b[0] - a[0]
	for c in ps:
		if dy * (c[0] - a[0]) != dx * (c[1] - a[1]):
			pp.append(c)
	if len(pp) <= 2:
		return True
	a = pp[0]
	b = pp[1]
	dy = b[1] - a[1]
	dx = b[0] - a[0]
	for c in pp:
		if dy * (c[0] - a[0]) != dx * (c[1] - a[1]):
			return False
	return True
for _ in range(n):
	ps.append(tuple(R()))
if n <= 4:
	print('YES')
elif ff(ps[0], ps[1]) or ff(ps[0], ps[2]) or ff(ps[1], ps[2]):
	print('YES')
else:
	print('NO')


def iscollinear(p1, p2, p3):
	(x1, y1) = p1
	(x2, y2) = p2
	(x3, y3) = p3
	cross = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)
	ans = bool(cross)
	return not ans

def checkfortwolines(a, b, points):
	set1 = set(points)
	for i in range(n):
		if iscollinear(a, b, points[i]):
			set1.remove(points[i])
	if len(set1) <= 2:
		return True
	else:
		pts1 = list(set1)
		for i in range(len(pts1)):
			if not iscollinear(pts1[0], pts1[1], pts1[i]):
				return False
		return True
n = int(input())
if n <= 4:
	print('YES')
else:
	points = [0 for i in range(n)]
	for i in range(n):
		points[i] = tuple(map(int, input().split()))
	a = points[0]
	b = points[1]
	c = points[2]
	if checkfortwolines(a, b, points) or checkfortwolines(b, c, points) or checkfortwolines(c, a, points):
		print('YES')
	else:
		print('NO')


n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
	(xi, yi) = map(int, input().split())
	(x[i], y[i]) = (xi, yi)
if n <= 4:
	print('YES')
	exit()
l = lambda i, j, k: (y[i] - y[j]) * (x[i] - x[k]) == (y[i] - y[k]) * (x[i] - x[j])

def check(ind):
	if len(ind) <= 2:
		return True
	for k in range(2, len(ind)):
		if not l(ind[0], ind[1], ind[k]):
			return False
	return True

def diff(i, j):
	return [_ for _ in range(n) if not l(i, j, _)]
df = diff(0, 1)
if check(df):
	print('YES')
	exit()
f = df[0]
df2 = diff(0, f)
if check(df2):
	print('YES')
	exit()
df3 = diff(1, f)
if check(df3):
	print('YES')
	exit()
print('NO')


import sys
input = sys.stdin.readline

class vector2:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __sub__(self, other):
		return vector2(self.x - other.x, self.y - other.y)

	def __mul__(self, other):
		return self.x * other.y - self.y * other.x

def oneline(a, b, c):
	(x, y) = (b - a, c - a)
	return x * y == 0

def oneline2(a):
	if len(a) <= 2:
		return True
	for i in range(2, len(a)):
		if not oneline(a[0], a[1], a[i]):
			return False
	return True
n = int(input())
a = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append(vector2(x, y))
if n <= 3:
	print('YES')
	exit()
b = []
for i in range(2, n):
	if not oneline(a[0], a[1], a[i]):
		b.append(a[i])
if not b or oneline2(b):
	print('YES')
	exit()
p = b[0]
b = []
for i in range(n):
	if not oneline(a[0], p, a[i]):
		b.append(a[i])
if not b or oneline2(b):
	print('YES')
	exit()
b = []
for i in range(n):
	if not oneline(a[1], p, a[i]):
		b.append(a[i])
if not b or oneline2(b):
	print('YES')
	exit()
print('NO')


def collinear(a, b, c):
	return a[0] * (b[1] - c[1]) + b[0] * (c[1] - a[1]) + c[0] * (a[1] - b[1])

def check(a, pt1, pt2):
	tmp = []
	for x in a:
		if collinear(a[pt1], x, a[pt2]) != 0:
			tmp.append(x)
	if len(tmp) < 3:
		return True
	x = tmp[0]
	y = tmp[1]
	for z in tmp:
		if collinear(x, z, y) != 0:
			return False
	return True
n = int(input())
ok = False
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
if n < 5 or check(a, 0, 1) or check(a, 0, 2) or check(a, 1, 2):
	ok = True
if ok == True:
	print('YES')
else:
	print('NO')


import math

def read_int():
	return int(input().strip())

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

def vector(p0, p1):
	v = [p0[0] - p1[0], p0[1] - p1[1]]
	if v[0] == 0:
		return [0, 1]
	if v[1] == 0:
		return [1, 0]
	gcd = math.gcd(*v)
	return [v[0] // gcd, v[1] // gcd]

def is_parallel(v0, v1):
	return v0 == v1 or [-v0[0], -v0[1]] == v1

def not_on_the_line(points):
	v0 = vector(points[0], points[1])
	others = []
	for i in range(2, len(points)):
		if not is_parallel(v0, vector(points[0], points[i])):
			others.append(points[i])
	return others

def solve():
	n = read_int()
	points = []
	for _ in range(n):
		points.append(read_ints())
	if n < 5:
		return 'YES'
	points2 = not_on_the_line(points)
	if len(points2) < 3:
		return 'YES'
	if len(not_on_the_line(points2)) == 0:
		return 'YES'
	(points[1], points[2]) = (points[2], points[1])
	points2 = not_on_the_line(points)
	if len(points2) < 3:
		return 'YES'
	if len(not_on_the_line(points2)) == 0:
		return 'YES'
	(points[0], points[2]) = (points[2], points[0])
	points2 = not_on_the_line(points)
	if len(points2) < 3:
		return 'YES'
	if len(not_on_the_line(points2)) == 0:
		return 'YES'
	return 'NO'
print(solve())


n = int(input())
L = [(0, 0)] * n
for i in range(n):
	t = input().split(' ')
	a = int(t[0])
	b = int(t[1])
	L[i] = (a, b)
if n <= 4:
	print('YES')
else:
	b0 = True
	b1 = True
	b2 = True
	L0 = []
	L1 = []
	L2 = []
	for j in range(n):
		if (L[0][0] - L[1][0]) * (L[0][1] - L[j][1]) != (L[0][1] - L[1][1]) * (L[0][0] - L[j][0]):
			L2.append(L[j])
		if (L[2][0] - L[0][0]) * (L[2][1] - L[j][1]) != (L[2][1] - L[0][1]) * (L[2][0] - L[j][0]):
			L1.append(L[j])
		if (L[2][0] - L[1][0]) * (L[2][1] - L[j][1]) != (L[2][1] - L[1][1]) * (L[2][0] - L[j][0]):
			L0.append(L[j])
	if len(L0) >= 3:
		for j in range(2, len(L0)):
			if (L0[0][0] - L0[1][0]) * (L0[0][1] - L0[j][1]) != (L0[0][1] - L0[1][1]) * (L0[0][0] - L0[j][0]):
				b0 = False
	if len(L1) >= 3:
		for j in range(2, len(L1)):
			if (L1[0][0] - L1[1][0]) * (L1[0][1] - L1[j][1]) != (L1[0][1] - L1[1][1]) * (L1[0][0] - L1[j][0]):
				b1 = False
	if len(L2) >= 3:
		for j in range(2, len(L2)):
			if (L2[0][0] - L2[1][0]) * (L2[0][1] - L2[j][1]) != (L2[0][1] - L2[1][1]) * (L2[0][0] - L2[j][0]):
				b2 = False
	if b0 or b1 or b2:
		print('YES')
	else:
		print('NO')


from collections import namedtuple
from itertools import combinations
Point = namedtuple('Point', ['x', 'y'])

def read():
	(x, y) = input().split()
	return Point(int(x), int(y))

def doubled_oriented_area(p1, p2, p3):
	return (p3.y - p1.y) * (p2.x - p1.x) - (p3.x - p1.x) * (p2.y - p1.y)

def filter_points(p1, p2, points):
	res = []
	for p in points:
		if doubled_oriented_area(p1, p2, p) != 0:
			res.append(p)
	return res

def on_the_same_line(points):
	if len(points) < 3:
		return True
	return not filter_points(points[0], points[1], points[2:])

def main():
	n = int(input())
	if n <= 4:
		print('YES')
		return
	points = []
	for i in range(n):
		points.append(read())
	for p in combinations(range(3), 2):
		filtered = filter_points(points[p[0]], points[p[1]], points)
		if on_the_same_line(filtered):
			print('YES')
			return
	print('NO')
main()


n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
f = lambda a, b, c: (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])

def g(fi, se, p):
	q = []
	for x in p:
		if f(fi, se, x):
			if len(q) < 2:
				q.append(x)
			elif f(q[0], q[1], x):
				return 1
	return 0
print('NO' if n > 4 and all([g(p[0], p[1], p), g(p[0], p[2], p), g(p[1], p[2], p)]) else 'YES')


import math
import sys
from collections import defaultdict

def solve(io):
	N = io.readInt()
	P = [None] * N
	for i in range(0, N):
		X = io.readInt()
		Y = io.readInt()
		P[i] = (X, Y)
	if N <= 4:
		io.println('YES')
		return
	for i in range(0, 3):
		(P[0], P[i]) = (P[i], P[0])
		if can(P):
			io.println('YES')
			return
	io.println('NO')

def can(P):
	slopes = makeSlopeDict(P)
	if len(slopes) <= 2:
		return True
	matches = 0
	others = []
	for (_, v) in slopes.items():
		if len(v) > 1:
			matches += 1
		else:
			others += v
	if matches > 1:
		return False
	line = makeSlopeDict(others)
	return len(line) <= 1

def makeSlopeDict(pts):
	slopes = defaultdict(set)
	for i in range(1, len(pts)):
		dx = pts[i][0] - pts[0][0]
		dy = pts[i][1] - pts[0][1]
		if dy < 0:
			dx *= -1
			dy *= -1
		if dx != 0 and dy != 0:
			g = math.gcd(dx, dy)
			v = (dx / g, dy / g)
		elif dx == 0 and dy != 0:
			v = (0, 1)
		elif dx != 0 and dy == 0:
			v = (1, 0)
		else:
			v = (0, 0)
		slopes[v].add(pts[i])
	return slopes

class IO:
	input = None
	output = None
	raw = ''
	buf = []
	pos = 0

	def __init__(self, inputStream, outputStream):
		self.input = inputStream
		self.output = outputStream

	def readToBuffer(self):
		self.raw = self.input.readline().rstrip('\n')
		self.buf = self.raw.split()
		self.pos = 0

	def readString(self):
		while self.pos == len(self.buf):
			self.readToBuffer()
		ans = self.buf[self.pos]
		self.pos += 1
		return ans

	def readInt(self):
		return int(self.readString())

	def readFloat(self):
		return float(self.readString())

	def readStringArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readString())
		return arr

	def readIntArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readInt())
		return arr

	def readFloatArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readFloat())
		return arr

	def readLine(self):
		while self.pos == len(self.buf):
			self.readToBuffer()
		if self.pos > 0:
			raise ValueError('Cannot call readline in the middle of a line.')
		return self.raw

	def print(self, s):
		self.output.write(str(s))

	def println(self, s):
		self.print(s)
		self.print('\n')

	def flushOutput(self):
		self.output.flush()
pythonIO = IO(sys.stdin, sys.stdout)
solve(pythonIO)
pythonIO.flushOutput()


import sys
from itertools import combinations
n = int(sys.stdin.readline().strip())
xys = [tuple(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]
xys = list(set(xys))
if len(xys) < 5:
	print('YES')
	return

def is_on_line(p0, p1, p2):
	return (p1[0] - p0[0]) * (p2[1] - p0[1]) == (p1[1] - p0[1]) * (p2[0] - p0[0])
l1 = (-1, -1, -1)
for comb in combinations(list(range(5)), 3):
	if is_on_line(xys[comb[0]], xys[comb[1]], xys[comb[2]]):
		l1 = comb
		break
if l1[0] < 0:
	print('NO')
	return
line = [0 for _ in range(n)]
for l in l1:
	line[l] = 1
for i in range(n):
	if i in l1:
		continue
	if is_on_line(xys[l1[0]], xys[l1[1]], xys[i]):
		line[i] = 1
nline = [i for i in range(n) if line[i] == 0]
if len(nline) < 3:
	print('YES')
	return
for i in nline[2:]:
	if not is_on_line(xys[nline[0]], xys[nline[1]], xys[i]):
		print('NO')
		return
print('YES')


def read_data():
	n = int(input().strip())
	a = []
	for i in range(n):
		line = tuple(map(int, input().strip().split()))
		a.append(line)
	return (n, a)

def is_on_line(a, b, c):
	return 1 if a[0] * (b[1] - c[1]) + b[0] * (c[1] - a[1]) + c[0] * (a[1] - b[1]) == 0 else 0

def solve():
	if n <= 4:
		return 1
	line1 = []
	line2 = []
	ok = 1
	for i in range(n):
		if not is_on_line(a[0], a[1], a[i]):
			if len(line2) < 2:
				line2.append(i)
			else:
				ok *= is_on_line(a[line2[0]], a[line2[1]], a[i])
				if ok == 0:
					break
	if ok:
		return 1
	line1 = []
	line2 = []
	ok = 1
	for i in range(n):
		if not is_on_line(a[0], a[2], a[i]):
			if len(line2) < 2:
				line2.append(i)
			else:
				ok *= is_on_line(a[line2[0]], a[line2[1]], a[i])
				if ok == 0:
					break
	if ok:
		return 1
	line1 = []
	line2 = []
	ok = 1
	for i in range(n):
		if not is_on_line(a[1], a[2], a[i]):
			if len(line2) < 2:
				line2.append(i)
			else:
				ok *= is_on_line(a[line2[0]], a[line2[1]], a[i])
				if ok == 0:
					break
	if ok:
		return 1
	return 0
(n, a) = read_data()
print('Yes' if solve() == 1 else 'No')


from collections import Counter
from random import choice
from sys import stdin
from time import time
from math import gcd

def get_v(p0, p1):
	dp = (p1[0] - p0[0], p1[1] - p0[1])
	g = gcd(*dp)
	if dp[0] > 0:
		return (dp[0] // g, dp[1] // g)
	elif dp[0] < 0:
		return (-dp[0] // g, -dp[1] // g)
	else:
		return (dp[0] // g, abs(dp[1] // g))
all_in = stdin.read().splitlines()
n = int(all_in[0])
points = [tuple(map(int, el.split())) for el in all_in[1:]]
if n <= 4:
	print('YES')
	exit()
p_max_ = 1
t = time()
while p_max_ == 1:
	p = choice(points)
	v_s = [get_v(p, x) for x in points if x != p]
	if len(set(v_s)) <= 2:
		print('YES')
		exit()
	C = Counter(v_s)
	(p_max, p_max_) = sorted(C.items(), key=lambda x: x[1])[-1]
	if time() - t > 1.75:
		print('NO')
		exit()
points.remove(p)
points_ = [points[i - 1] for i in range(1, n) if v_s[i - 1] != p_max]
if len(points_) <= 2:
	print('YES')
	exit()
p_ = choice(points_)
v_s_ = [get_v(p_, x) for x in points_ if x != p_]
if len(set(v_s_)) >= 2:
	print('NO')
	exit()
print('YES')


class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

class Vector:

	def __init__(self, start, end):
		self.x = end.x - start.x
		self.y = end.y - start.y

	def mult(self, a):
		return self.y * a.x - self.x * a.y
n = int(input())
points = []
for i in range(n):
	(x, y) = list(map(int, input().split()))
	points.append(Point(x, y))
if n <= 3:
	print('YES')
	return

def onLine(points):
	n = len(points)
	if n < 3:
		return True
	a = Vector(points[0], points[1])
	for i in range(2, n):
		b = Vector(points[0], points[i])
		if a.mult(b) != 0:
			return False
	return True
tmp = [points[0], points[1]]
oth = []
for i in range(2, n):
	tmp.append(points[i])
	if not onLine(tmp):
		oth.append(points[i])
	tmp.pop()
if onLine(oth):
	print('YES')
	return
tmp = [points[0], points[2]]
oth = []
for i in range(1, n):
	if i == 2:
		continue
	tmp.append(points[i])
	if not onLine(tmp):
		oth.append(points[i])
	tmp.pop()
if onLine(oth):
	print('YES')
	return
tmp = [points[1], points[2]]
oth = []
for i in range(0, n):
	if i == 2 or i == 1:
		continue
	tmp.append(points[i])
	if not onLine(tmp):
		oth.append(points[i])
	tmp.pop()
if onLine(oth):
	print('YES')
	return
print('NO')


from itertools import combinations
from fractions import gcd

def main():
	n = int(input())
	p = [list(map(int, input().split())) for _ in range(n)]
	print(solve(n, p))

def solve(n, p):
	if n < 5:
		return 'YES'
	p5 = p[:5]
	lines = set((line(p1, p2) for (p1, p2) in combinations(p5, 2)))
	l0 = None
	for l in lines:
		if nb_points(l, p5) > 2:
			l0 = l
			break
	if l0 is None:
		return 'NO'
	pr = [pi for pi in p if not belongs(pi, l0)]
	if colinear(pr):
		return 'YES'
	return 'NO'

def line(p1, p2):
	(x1, y1) = p1
	(x2, y2) = p2
	a = y2 - y1
	b = x1 - x2
	c = x2 * y1 - x1 * y2
	if a < 0:
		(a, b, c) = (-a, -b, -c)
	if a == 0:
		if b < 0:
			(b, c) = (-b, -c)
		if c == 0:
			b = 1
		else:
			g = abs(gcd(b, c))
			(b, c) = (b // g, c // g)
	elif b == 0:
		if c == 0:
			a = 1
		else:
			g = abs(gcd(a, c))
			(a, c) = (a // g, c // g)
	elif c == 0:
		g = abs(gcd(a, b))
		(a, b) = (a // g, b // g)
	else:
		g = abs(gcd(gcd(a, b), c))
		(a, b, c) = (a // g, b // g, c // g)
	return (a, b, c)

def belongs(pi, l):
	(a, b, c) = l
	return a * pi[0] + b * pi[1] + c == 0

def nb_points(l, p):
	return sum((1 for pi in p if belongs(pi, l)))

def colinear(p):
	if len(p) <= 2:
		return True
	l = line(p[0], p[1])
	return all((belongs(pi, l) for pi in p[2:]))
main()


import sys
import math

def main():
	i = sys.stdin.readlines()
	n = int(i[0].strip())
	points = []
	for pi in range(n):
		p = i[pi + 1]
		(x, y) = p.strip().split()
		points.append([int(x), int(y)])
	if n < 5:
		print('YES')
		return
	st = [False] * n

	def run(first, second):
		dx = first[0] - second[0]
		dy = first[1] - second[1]
		for (i, p) in enumerate(points):
			if st[i]:
				continue
			if dx == 0:
				if p[0] == first[0]:
					st[i] = True
			elif dy == 0:
				if p[1] == first[1]:
					st[i] = True
			elif (p[0] - first[0]) * dy == (p[1] - first[1]) * dx:
				st[i] = True

	def check(fi, si):
		for i in range(n):
			st[i] = i == fi or i == si
		run(points[fi], points[si])
		fi = None
		si = None
		for i in range(n - 1):
			if not st[i]:
				fi = i
				for j in range(i + 1, n):
					if not st[j]:
						si = j
						break
				break
		if fi is None or si is None:
			return True
		st[fi] = True
		st[si] = True
		run(points[fi], points[si])
		return not False in st
	if check(0, 1) or check(0, 2) or check(1, 2):
		print('YES')
	else:
		print('NO')
main()


from decimal import Decimal

class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __eq__(self, other):
		return self.x == other.x and self.y == other.y

	def __hash__(self):
		return self.x.__hash__() ^ self.y.__hash__()

class Line:

	def __init__(self, p1, p2):
		self.A = p1.y - p2.y
		self.B = p2.x - p1.x
		self.C = p1.x * p2.y - p2.x * p1.y

	def isPointOnLine(self, p):
		if self.A * p.x + self.B * p.y + self.C == 0:
			return True
		else:
			return False

	def __eq__(self, line):
		if (self.A == 0) != (line.A == 0) or (self.B == 0) != (line.B == 0) or (self.C == 0) != (line.C == 0):
			return False
		t = 0
		if self.A != 0:
			t = Decimal(self.A) / Decimal(line.A)
		if self.B != 0:
			if t == 0:
				t = Decimal(self.B) / Decimal(line.B)
			elif t != Decimal(self.B) / Decimal(line.B):
				return False
		if self.C != 0:
			if t == 0:
				t = Decimal(self.C) / Decimal(line.C)
			elif t != Decimal(self.C) / Decimal(line.C):
				return False
		return True
n = int(input())
points = []
for i in range(0, n):
	a = list(map(int, input().split()))
	points.append(Point(a[0], a[1]))
ans = ''
if n < 5:
	ans = 'Yes'
else:
	lines = []
	linePoints = []
	lines.append(Line(points[0], points[1]))
	linePoints.append([points[0], points[1]])
	for i in range(1, 5):
		for j in range(0, i):
			if i != j:
				line = Line(points[i], points[j])
				exist = False
				for k in range(0, len(lines)):
					if lines[k] == line:
						exist = True
						existP = False
						for p in range(0, len(linePoints[k])):
							if linePoints[k][p] == points[i]:
								existP = True
								break
						if not existP:
							linePoints[k].append(points[i])
				if not exist:
					lines.append(Line(points[i], points[j]))
					linePoints.append([points[i], points[j]])
	firstLine = 0
	secondLine = 0
	i_point = 0
	if len(lines) == 9:
		ans == 'No'
	else:
		if len(lines) == 8 or len(lines) == 6:
			for i in range(0, len(linePoints)):
				if len(linePoints[i]) == 3:
					firstLine = i
			for i in range(0, len(linePoints)):
				if len(set(linePoints[i]) - set(linePoints[firstLine])) == 2:
					secondLine = i
			lines = [lines[firstLine], lines[secondLine]]
			linePoints = [linePoints[firstLine], linePoints[secondLine]]
		elif len(lines) == 5:
			for i in range(0, len(linePoints)):
				if len(linePoints[i]) == 4:
					firstLine = i
			fifth_point = list(set(points[:5]) - set(linePoints[firstLine]))[0]
			if len(points) > 5:
				for i in range(5, len(points)):
					exist = False
					if not lines[firstLine].isPointOnLine(points[i]):
						six_point = points[i]
						lines = [lines[firstLine], Line(fifth_point, six_point)]
						i_point = i + 1
						exist = True
						break
				if not exist:
					ans = 'Yes'
			else:
				ans = 'Yes'
		elif len(lines) == 1:
			if len(points) > 5:
				for i in range(5, len(points)):
					exist = False
					if not lines[0].isPointOnLine(points[i]):
						first_point = points[i]
						i_point = i + 1
						exist = True
						break
				if exist:
					if len(points) > i_point:
						for i in range(i_point, len(points)):
							exist = False
							if not lines[0].isPointOnLine(points[i]):
								second_point = points[i]
								i_point = i + 1
								exist = True
								lines = [lines[0], Line(first_point, second_point)]
								break
						if not exist:
							ans = 'Yes'
					else:
						ans = 'Yes'
				else:
					ans = 'Yes'
			else:
				ans = 'Yes'
		if ans == '' and len(points) > i_point:
			exist = False
			for i in range(i_point, len(points)):
				if not (lines[0].isPointOnLine(points[i]) or lines[1].isPointOnLine(points[i])):
					exist = True
					ans = 'No'
					break
			if not exist:
				ans = 'Yes'
		else:
			ans = 'Yes'
print(ans)


from itertools import combinations
import sys
d = [int(x) for x in sys.stdin.read().split()][1:]
ps = list(zip(d[::2], d[1::2]))

def outside(pt, v1, v2):
	return (pt[0] - v2[0]) * (v1[1] - v2[1]) - (pt[1] - v2[1]) * (v1[0] - v2[0])

def oneline(ps):
	return len(ps) <= 2 or not [p for p in ps if outside(p, ps[0], ps[1])]
if len(ps) <= 4:
	print('YES')
else:
	vs = (ps[:2] + [p for p in ps if outside(p, *ps[:2])] + [ps[0]])[:3]
	print('YES' if any((oneline([p for p in ps if outside(p, v1, v2)]) for (v1, v2) in combinations(vs, 2))) else 'NO')


def divisors(M):
	d = []
	i = 1
	while M >= i ** 2:
		if M % i == 0:
			d.append(i)
			if i ** 2 != M:
				d.append(M // i)
		i = i + 1
	return d

def popcount(x):
	x = x - (x >> 1 & 1431655765)
	x = (x & 858993459) + (x >> 2 & 858993459)
	x = x + (x >> 4) & 252645135
	x = x + (x >> 8)
	x = x + (x >> 16)
	return x & 127

def eratosthenes(n):
	res = [0 for i in range(n + 1)]
	prime = set([])
	for i in range(2, n + 1):
		if not res[i]:
			prime.add(i)
			for j in range(1, n // i + 1):
				res[i * j] = 1
	return prime

def factorization(n):
	res = []
	for p in prime:
		if n % p == 0:
			while n % p == 0:
				n //= p
			res.append(p)
	if n != 1:
		res.append(n)
	return res

def euler_phi(n):
	res = n
	for x in range(2, n + 1):
		if x ** 2 > n:
			break
		if n % x == 0:
			res = res // x * (x - 1)
			while n % x == 0:
				n //= x
	if n != 1:
		res = res // n * (n - 1)
	return res

def ind(b, n):
	res = 0
	while n % b == 0:
		res += 1
		n //= b
	return res

def isPrimeMR(n):
	d = n - 1
	d = d // (d & -d)
	L = [2, 3, 5, 7, 11, 13, 17]
	for a in L:
		t = d
		y = pow(a, t, n)
		if y == 1:
			continue
		while y != n - 1:
			y = y * y % n
			if y == 1 or t == n - 1:
				return 0
			t <<= 1
	return 1

def findFactorRho(n):
	from math import gcd
	m = 1 << n.bit_length() // 8
	for c in range(1, 99):
		f = lambda x: (x * x + c) % n
		(y, r, q, g) = (2, 1, 1, 1)
		while g == 1:
			x = y
			for i in range(r):
				y = f(y)
			k = 0
			while k < r and g == 1:
				ys = y
				for i in range(min(m, r - k)):
					y = f(y)
					q = q * abs(x - y) % n
				g = gcd(q, n)
				k += m
			r <<= 1
		if g == n:
			g = 1
			while g == 1:
				ys = f(ys)
				g = gcd(abs(x - ys), n)
		if g < n:
			if isPrimeMR(g):
				return g
			elif isPrimeMR(n // g):
				return n // g
			return findFactorRho(g)

def primeFactor(n):
	i = 2
	ret = {}
	rhoFlg = 0
	while i * i <= n:
		k = 0
		while n % i == 0:
			n //= i
			k += 1
		if k:
			ret[i] = k
		i += 1 + i % 2
		if i == 101 and n >= 2 ** 20:
			while n > 1:
				if isPrimeMR(n):
					(ret[n], n) = (1, 1)
				else:
					rhoFlg = 1
					j = findFactorRho(n)
					k = 0
					while n % j == 0:
						n //= j
						k += 1
					ret[j] = k
	if n > 1:
		ret[n] = 1
	if rhoFlg:
		ret = {x: ret[x] for x in sorted(ret)}
	return ret

def divisors(n):
	res = [1]
	prime = primeFactor(n)
	for p in prime:
		newres = []
		for d in res:
			for j in range(prime[p] + 1):
				newres.append(d * p ** j)
		res = newres
	res.sort()
	return res

def xorfactorial(num):
	if num == 0:
		return 0
	elif num == 1:
		return 1
	elif num == 2:
		return 3
	elif num == 3:
		return 0
	else:
		x = baseorder(num)
		return 2 ** x * ((num - 2 ** x + 1) % 2) + function(num - 2 ** x)

def xorconv(n, X, Y):
	if n == 0:
		res = [X[0] * Y[0] % mod]
		return res
	x = [X[i] + X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	y = [Y[i] + Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	z = [X[i] - X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	w = [Y[i] - Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	res1 = xorconv(n - 1, x, y)
	res2 = xorconv(n - 1, z, w)
	former = [(res1[i] + res2[i]) * inv for i in range(2 ** (n - 1))]
	latter = [(res1[i] - res2[i]) * inv for i in range(2 ** (n - 1))]
	former = list(map(lambda x: x % mod, former))
	latter = list(map(lambda x: x % mod, latter))
	return former + latter

def merge_sort(A, B):
	(pos_A, pos_B) = (0, 0)
	(n, m) = (len(A), len(B))
	res = []
	while pos_A < n and pos_B < m:
		(a, b) = (A[pos_A], B[pos_B])
		if a < b:
			res.append(a)
			pos_A += 1
		else:
			res.append(b)
			pos_B += 1
	res += A[pos_A:]
	res += B[pos_B:]
	return res

class UnionFindVerSize:

	def __init__(self, N):
		self._parent = [n for n in range(0, N)]
		self._size = [1] * N
		self.group = N

	def find_root(self, x):
		if self._parent[x] == x:
			return x
		self._parent[x] = self.find_root(self._parent[x])
		stack = [x]
		while self._parent[stack[-1]] != stack[-1]:
			stack.append(self._parent[stack[-1]])
		for v in stack:
			self._parent[v] = stack[-1]
		return self._parent[x]

	def unite(self, x, y):
		gx = self.find_root(x)
		gy = self.find_root(y)
		if gx == gy:
			return
		self.group -= 1
		if self._size[gx] < self._size[gy]:
			self._parent[gx] = gy
			self._size[gy] += self._size[gx]
		else:
			self._parent[gy] = gx
			self._size[gx] += self._size[gy]

	def get_size(self, x):
		return self._size[self.find_root(x)]

	def is_same_group(self, x, y):
		return self.find_root(x) == self.find_root(y)

class WeightedUnionFind:

	def __init__(self, N):
		self.parent = [i for i in range(N)]
		self.size = [1 for i in range(N)]
		self.val = [0 for i in range(N)]
		self.flag = True
		self.edge = [[] for i in range(N)]

	def dfs(self, v, pv):
		stack = [(v, pv)]
		new_parent = self.parent[pv]
		while stack:
			(v, pv) = stack.pop()
			self.parent[v] = new_parent
			for (nv, w) in self.edge[v]:
				if nv != pv:
					self.val[nv] = self.val[v] + w
					stack.append((nv, v))

	def unite(self, x, y, w):
		if not self.flag:
			return
		if self.parent[x] == self.parent[y]:
			self.flag = self.val[x] - self.val[y] == w
			return
		if self.size[self.parent[x]] > self.size[self.parent[y]]:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[x] += self.size[y]
			self.val[y] = self.val[x] - w
			self.dfs(y, x)
		else:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[y] += self.size[x]
			self.val[x] = self.val[y] + w
			self.dfs(x, y)

class Dijkstra:

	class Edge:

		def __init__(self, _to, _cost):
			self.to = _to
			self.cost = _cost

	def __init__(self, V):
		self.G = [[] for i in range(V)]
		self._E = 0
		self._V = V

	@property
	def E(self):
		return self._E

	@property
	def V(self):
		return self._V

	def add_edge(self, _from, _to, _cost):
		self.G[_from].append(self.Edge(_to, _cost))
		self._E += 1

	def shortest_path(self, s):
		import heapq
		que = []
		d = [10 ** 15] * self.V
		d[s] = 0
		heapq.heappush(que, (0, s))
		while len(que) != 0:
			(cost, v) = heapq.heappop(que)
			if d[v] < cost:
				continue
			for i in range(len(self.G[v])):
				e = self.G[v][i]
				if d[e.to] > d[v] + e.cost:
					d[e.to] = d[v] + e.cost
					heapq.heappush(que, (d[e.to], e.to))
		return d

def Z_algorithm(s):
	N = len(s)
	Z_alg = [0] * N
	Z_alg[0] = N
	i = 1
	j = 0
	while i < N:
		while i + j < N and s[j] == s[i + j]:
			j += 1
		Z_alg[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < N and k + Z_alg[k] < j:
			Z_alg[i + k] = Z_alg[k]
			k += 1
		i += k
		j -= k
	return Z_alg

class BIT:

	def __init__(self, n):
		self.BIT = [0] * (n + 1)
		self.num = n

	def query(self, idx):
		res_sum = 0
		while idx > 0:
			res_sum += self.BIT[idx]
			idx -= idx & -idx
		return res_sum

	def update(self, idx, x):
		while idx <= self.num:
			self.BIT[idx] += x
			idx += idx & -idx
		return

class dancinglink:

	def __init__(self, n, debug=False):
		self.n = n
		self.debug = debug
		self._left = [i - 1 for i in range(n)]
		self._right = [i + 1 for i in range(n)]
		self.exist = [True for i in range(n)]

	def pop(self, k):
		if self.debug:
			assert self.exist[k]
		L = self._left[k]
		R = self._right[k]
		if L != -1:
			if R != self.n:
				(self._right[L], self._left[R]) = (R, L)
			else:
				self._right[L] = self.n
		elif R != self.n:
			self._left[R] = -1
		self.exist[k] = False

	def left(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._left[res]
			if res == -1:
				break
			k -= 1
		return res

	def right(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._right[res]
			if res == self.n:
				break
			k -= 1
		return res

class SparseTable:

	def __init__(self, A, merge_func, ide_ele):
		N = len(A)
		n = N.bit_length()
		self.table = [[ide_ele for i in range(n)] for i in range(N)]
		self.merge_func = merge_func
		for i in range(N):
			self.table[i][0] = A[i]
		for j in range(1, n):
			for i in range(0, N - 2 ** j + 1):
				f = self.table[i][j - 1]
				s = self.table[i + 2 ** (j - 1)][j - 1]
				self.table[i][j] = self.merge_func(f, s)

	def query(self, s, t):
		b = t - s + 1
		m = b.bit_length() - 1
		return self.merge_func(self.table[s][m], self.table[t - 2 ** m + 1][m])

class BinaryTrie:

	class node:

		def __init__(self, val):
			self.left = None
			self.right = None
			self.max = val

	def __init__(self):
		self.root = self.node(-10 ** 15)

	def append(self, key, val):
		pos = self.root
		for i in range(29, -1, -1):
			pos.max = max(pos.max, val)
			if key >> i & 1:
				if pos.right is None:
					pos.right = self.node(val)
					pos = pos.right
				else:
					pos = pos.right
			elif pos.left is None:
				pos.left = self.node(val)
				pos = pos.left
			else:
				pos = pos.left
		pos.max = max(pos.max, val)

	def search(self, M, xor):
		res = -10 ** 15
		pos = self.root
		for i in range(29, -1, -1):
			if pos is None:
				break
			if M >> i & 1:
				if xor >> i & 1:
					if pos.right:
						res = max(res, pos.right.max)
					pos = pos.left
				else:
					if pos.left:
						res = max(res, pos.left.max)
					pos = pos.right
			elif xor >> i & 1:
				pos = pos.right
			else:
				pos = pos.left
		if pos:
			res = max(res, pos.max)
		return res

def solveequation(edge, ans, n, m):
	x = [0] * m
	used = [False] * n
	for v in range(n):
		if used[v]:
			continue
		y = dfs(v)
		if y != 0:
			return False
	return x

	def dfs(v):
		used[v] = True
		r = ans[v]
		for (to, dire, id) in edge[v]:
			if used[to]:
				continue
			y = dfs(to)
			if dire == -1:
				x[id] = y
			else:
				x[id] = -y
			r += y
		return r

class Matrix:
	mod = 10 ** 9 + 7

	def set_mod(m):
		Matrix.mod = m

	def __init__(self, L):
		self.row = len(L)
		self.column = len(L[0])
		self._matrix = L
		for i in range(self.row):
			for j in range(self.column):
				self._matrix[i][j] %= Matrix.mod

	def __getitem__(self, item):
		if type(item) == int:
			raise IndexError('you must specific row and column')
		elif len(item) != 2:
			raise IndexError('you must specific row and column')
		(i, j) = item
		return self._matrix[i][j]

	def __setitem__(self, item, val):
		if type(item) == int:
			raise IndexError('you must specific row and column')
		elif len(item) != 2:
			raise IndexError('you must specific row and column')
		(i, j) = item
		self._matrix[i][j] = val

	def __add__(self, other):
		if (self.row, self.column) != (other.row, other.column):
			raise SizeError('sizes of matrixes are different')
		res = [[0 for j in range(self.column)] for i in range(self.row)]
		for i in range(self.row):
			for j in range(self.column):
				res[i][j] = self._matrix[i][j] + other._matrix[i][j]
				res[i][j] %= Matrix.mod
		return Matrix(res)

	def __sub__(self, other):
		if (self.row, self.column) != (other.row, other.column):
			raise SizeError('sizes of matrixes are different')
		res = [[0 for j in range(self.column)] for i in range(self.row)]
		for i in range(self.row):
			for j in range(self.column):
				res[i][j] = self._matrix[i][j] - other._matrix[i][j]
				res[i][j] %= Matrix.mod
		return Matrix(res)

	def __mul__(self, other):
		if type(other) != int:
			if self.column != other.row:
				raise SizeError('sizes of matrixes are different')
			res = [[0 for j in range(other.column)] for i in range(self.row)]
			for i in range(self.row):
				for j in range(other.column):
					temp = 0
					for k in range(self.column):
						temp += self._matrix[i][k] * other._matrix[k][j]
					res[i][j] = temp % Matrix.mod
			return Matrix(res)
		else:
			n = other
			res = [[n * self._matrix[i][j] % Matrix.mod for j in range(self.column)] for i in range(self.row)]
			return Matrix(res)

	def __pow__(self, m):
		if self.column != self.row:
			raise MatrixPowError('the size of row must be the same as that of column')
		n = self.row
		res = Matrix([[int(i == j) for i in range(n)] for j in range(n)])
		while m:
			if m % 2 == 1:
				res = res * self
			self = self * self
			m //= 2
		return res

	def __str__(self):
		res = []
		for i in range(self.row):
			for j in range(self.column):
				res.append(str(self._matrix[i][j]))
				res.append(' ')
			res.append('\n')
		res = res[:len(res) - 1]
		return ''.join(res)
import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import log, gcd
input = lambda : sys.stdin.readline().rstrip()
mi = lambda : map(int, input().split())
li = lambda : list(mi())
n = int(input())
X = [0 for i in range(n)]
Y = [0 for i in range(n)]
for _ in range(n):
	(X[_], Y[_]) = mi()

def solve(n, X, Y):
	if n <= 3:
		return True

	def check(i, j, k):
		return (Y[k] - Y[j]) * (X[j] - X[i]) == (Y[j] - Y[i]) * (X[k] - X[j])
	(a, b) = (-1, -1)
	for i in range(n):
		if not check(0, 1, i):
			if a == -1:
				a = i
			elif b == -1:
				b = i
			elif not check(a, i, b):
				break
	else:
		return True
	(a, b) = (-1, -1)
	for i in range(n):
		if not check(2, 1, i):
			if a == -1:
				a = i
			elif b == -1:
				b = i
			elif not check(a, i, b):
				break
	else:
		return True
	(a, b) = (-1, -1)
	for i in range(n):
		if not check(0, 2, i):
			if a == -1:
				a = i
			elif b == -1:
				b = i
			elif not check(a, i, b):
				break
	else:
		return True
	return False
print('YES' if solve(n, X, Y) else 'NO')


def cross(a, b):
	return a[0] * b[1] - a[1] * b[0]

def f(v, i1, i2):
	d = [v[i2][i] - v[i1][i] for i in range(len(v[i1]))]
	res = []
	for x in v:
		d2 = [x[i] - v[i1][i] for i in range(len(v[i1]))]
		if cross(d, d2) != 0:
			res.append(x)
	return res
n = int(input())
if n <= 4:
	print('YES')
	exit(0)
v = []
for i in range(n):
	v.append(list(map(int, input().split())))
ok = False
for first in range(3):
	if ok:
		break
	for second in range(first + 1, 3):
		other = f(v, first, second)
		if len(other) <= 2:
			ok = True
			break
		remainder = f(other, 0, 1)
		if not remainder:
			ok = True
if ok:
	print('YES')
else:
	print('NO')


def ff(a, b, p):
	ab = []
	for i in range(len(p)):
		if (a[1] - b[1]) * (p[i][0] - a[0]) != (p[i][1] - a[1]) * (a[0] - b[0]):
			ab.append(p[i])
	if len(ab) <= 2:
		return 1
	a = ab[0]
	b = ab[1]
	for i in range(len(ab)):
		if (a[1] - b[1]) * (ab[i][0] - a[0]) != (ab[i][1] - a[1]) * (a[0] - b[0]):
			return 0
	return 1
n = int(input())
I = lambda : map(int, input().split())
if n <= 4:
	print('YES')
else:
	p = []
	for i in range(n):
		(x, y) = I()
		p.append([x, y])
	if ff(p[0], p[1], p) or ff(p[1], p[2], p) or ff(p[0], p[2], p):
		print('YES')
	else:
		print('NO')


import sys
import random
n = int(input())
if n <= 3:
	print('YES')
	return
coord = [int(x) for line in sys.stdin for x in line.split()]
X = [coord[2 * i] for i in range(n)]
Y = [coord[2 * i + 1] for i in range(n)]
for i in range(13):
	a = random.randint(0, n - 1)
	b = random.randint(0, n - 2)
	if a == b:
		b += 1
	(x0, y0) = (X[a], Y[a])
	(x1, y1) = (X[b], Y[b])
	dx = x1 - x0
	dy = y1 - y0
	not_on_line = []
	for c in range(n):
		if c == a or c == b:
			continue
		(x2, y2) = (X[c], Y[c])
		Dx = x2 - x0
		Dy = y2 - y0
		if dx * Dy - dy * Dx != 0:
			not_on_line.append(c)
	if len(not_on_line) <= 1:
		print('YES')
		return
	a = not_on_line[0]
	b = not_on_line[1]
	(x0, y0) = (X[a], Y[a])
	(x1, y1) = (X[b], Y[b])
	dx = x1 - x0
	dy = y1 - y0
	can = True
	for c in not_on_line:
		if c == a or c == b:
			continue
		(x2, y2) = (X[c], Y[c])
		Dx = x2 - x0
		Dy = y2 - y0
		if dx * Dy - dy * Dx != 0:
			can = False
			break
	if can:
		print('YES')
		return
print('NO')


def gcd(a, b):
	if a > b:
		(a, b) = (b, a)
	if b % a == 0:
		return a
	return gcd(b % a, a)

def line(a, b):
	(x0, y0) = a
	(x1, y1) = b
	if x0 == x1:
		return [True, x1, None]
	else:
		slope_num = y1 - y0
		slope_den = x1 - x0
		if slope_num == 0:
			num = 0
			den = 1
		else:
			g = gcd(abs(slope_num), abs(slope_den))
			num = slope_num // g
			den = slope_den // g
		inter = den * y0 - num * x0
		if inter == 0:
			den2 = 1
		else:
			den2 = den
		return [False, num, den, inter, den2]

def online(line, a):
	(x0, y0) = a
	if line[0]:
		return x0 == line[1]
	else:
		(C, num, den, inter, den2) = line
		return num * x0 + inter == y0 * den

def process(A):
	n = len(A)
	if n <= 3:
		return 'YES'
	l1 = line(A[0], A[1])
	l2 = line(A[1], A[2])
	l3 = line(A[0], A[2])
	for Line1 in [l1, l2, l3]:
		other = []
		for x in A:
			if not online(Line1, x):
				other.append(x)
		if len(other) <= 2:
			return 'YES'
		a1 = other[0]
		a2 = other[1]
		Line2 = line(a1, a2)
		works = True
		for x in other:
			if not online(Line2, x):
				works = False
				break
		if works:
			return 'YES'
	return 'NO'
n = int(input())
A = []
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	A.append([x, y])
print(process(A))


import math

def get_line(x1, y1, x2, y2):
	a = x2 - x1
	b = y1 - y2
	c = x1 * (y2 - y1) - y1 * (x2 - x1)
	g = math.gcd(math.gcd(a, b), c)
	a //= g
	b //= g
	c //= g
	return (a, b, c)
n = int(input())
xy = []
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	xy.append((x, y))
if n <= 3:
	print('YES')
	exit()

def check(x1, y1, x2, y2, xy):
	(a1, b1, c1) = get_line(x1, y1, x2, y2)
	other_point = None
	cnt_other = 0
	(a2, b2, c2) = (0, 0, 0)
	for i in range(len(xy)):
		(x, y) = xy[i]
		if a1 * y + b1 * x + c1 != 0:
			if other_point is None:
				other_point = (x, y)
				cnt_other = 1
			elif cnt_other == 1:
				cnt_other = 2
				(a2, b2, c2) = get_line(*other_point, x, y)
			elif a2 * y + b2 * x + c2 != 0:
				return False
	return True
if check(*xy[0], *xy[1], xy[2:]):
	print('YES')
elif check(*xy[1], *xy[2], [xy[0]] + xy[3:]):
	print('YES')
elif check(*xy[0], *xy[2], [xy[1]] + xy[3:]):
	print('YES')
else:
	print('NO')


import sys
input = sys.stdin.readline
from math import gcd

def regular(x, y):
	if x == 0:
		return (0, 1)
	if y == 0:
		return (1, 0)
	g = gcd(x, y)
	if x < 0:
		g = -g
	x //= g
	y //= g
	return (x, y)

def linear(a, b, c):
	if len(set([a, b, c])) < 3:
		return True
	(q1, p1) = (a[1] - b[1], a[0] - b[0])
	x = regular(q1, p1)
	(q2, p2) = (b[1] - c[1], b[0] - c[0])
	y = regular(q2, p2)
	return x == y
n = int(input())
a = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append((x, y))
if n <= 4:
	print('YES')
	exit()
b = [a[0], a[1]]
d = dict()
d[a[0], a[1]] = 2
for i in range(2, n):
	lin = False
	for j in range(len(b) - 1):
		for k in range(j + 1, len(b)):
			(p1, p2) = (b[j], b[k])
			if linear(p1, p2, a[i]):
				lin = True
				d[p1, p2] += 1
	if not lin:
		for p in b:
			d[p, a[i]] = 2
		b.append(a[i])
		if len(b) == 4:
			break
if len(b) == 2:
	print('YES')
	exit()
if len(b) == 3:
	if min(d.values()) > 2:
		print('NO')
	else:
		print('YES')
	exit()
for i in range(len(b)):
	for j in range(i + 1, len(b)):
		(p1, p2) = (b[i], b[j])
		(p3, p4) = set(b) - set([p1, p2])
		poss = True
		for p in a:
			if linear(p1, p2, p) or linear(p3, p4, p):
				pass
			else:
				poss = False
				break
		if poss:
			print('YES')
			exit()
print('NO')


n = int(input().split()[0])
ps = []
for i in range(n):
	(a, b) = [int(x) for x in input().split()[:2]]
	ps.append([a, b])

def aline(a, b, c):
	x1 = a[1] - b[1]
	x2 = c[1] - b[1]
	y1 = a[0] - b[0]
	y2 = c[0] - b[0]
	if x1 * y2 == x2 * y1:
		return True
	else:
		return False

def left_fun(a, b, l):
	if len(l) < 3:
		return []
	to = [i for i in range(len(l)) if i != a and i != b]
	left = []
	for i in to:
		if not aline(ps[l[a]], ps[l[b]], ps[l[i]]):
			left.append(i)
	return left

def nm():
	if len(ps) < 5:
		print('YES')
		return
	l = [i for i in range(n)]
	left = left_fun(0, 1, l)
	left = left_fun(0, 1, left)
	if len(left) == 0:
		print('YES')
		return
	l = [i for i in range(n)]
	left = left_fun(1, 2, l)
	left = left_fun(0, 1, left)
	if len(left) == 0:
		print('YES')
		return
	l = [i for i in range(n)]
	left = left_fun(0, 2, l)
	left = left_fun(0, 1, left)
	if len(left) == 0:
		print('YES')
		return
	print('NO')
nm()


n = int(input())
lst = []
for x in range(n):
	(a, b) = list(map(int, input().split()))
	lst.append((a, b))

def scal(x1, y1, x2, y2, x3, y3):
	if (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1) == 0:
		return True
	return False

def check():
	for x in range(n - 2):
		if len(s2) >= 3:
			if not scal(lst[s2[-3]][0], lst[s2[-3]][1], lst[s2[-2]][0], lst[s2[-2]][1], lst[s2[-1]][0], lst[s2[-1]][1]):
				return False
		if scal(lst[0][0], lst[0][1], lst[1][0], lst[1][1], lst[x + 2][0], lst[x + 2][1]):
			s1.append(x + 2)
		else:
			s2.append(x + 2)
	if len(s2) >= 3:
		if not scal(lst[s2[-3]][0], lst[s2[-3]][1], lst[s2[-2]][0], lst[s2[-2]][1], lst[s2[-1]][0], lst[s2[-1]][1]):
			return False
	return True
flag = True
if n >= 5:
	s1 = []
	s2 = []
	if not check():
		(lst[1], lst[s2[0]]) = (lst[s2[0]], lst[1])
		x = s2[0]
		s1 = []
		s2 = []
		if not check():
			(lst[0], lst[s2[0]]) = (lst[s2[0]], lst[0])
			s1 = []
			s2 = []
			if not check():
				flag = False
if flag:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	points = []
	for i in range(n):
		(x, y) = map(int, input().split())
		points.append((x, y))
	if n < 5:
		print('YES')
	elif test(points[0], points[1], points) or test(points[0], points[2], points) or test(points[1], points[2], points):
		print('YES')
	else:
		print('NO')

def test(p, q, pts):
	temp = []
	for i in pts:
		if (p[1] - i[1]) * (p[0] - q[0]) != (p[1] - q[1]) * (p[0] - i[0]):
			temp.append(i)
	if len(temp) < 3:
		return True
	p = temp[0]
	q = temp[1]
	for i in temp:
		if (p[1] - i[1]) * (p[0] - q[0]) != (p[1] - q[1]) * (p[0] - i[0]):
			return False
	return True
main()


import sys
from collections import Counter, defaultdict
from math import gcd
n = int(sys.stdin.buffer.readline().decode('utf-8'))
points = [list(map(int, line.decode('utf-8').split())) for line in sys.stdin.buffer]
if n <= 4:
	print('YES')
	exit()
for i in range(3):
	cnt = Counter()
	idx = defaultdict(list)
	for (j, (x2, y2)) in enumerate(points):
		if i == j:
			continue
		(dx, dy) = (points[i][0] - x2, points[i][1] - y2)
		if dy == 0:
			dx = 1
		elif dx == 0:
			dy = 1
		elif dy < 0:
			(dx, dy) = (-dx, -dy)
		g = gcd(abs(dx), abs(dy))
		dx //= g
		dy //= g
		cnt[dx, dy] += 1
		idx[dx, dy].append(j)
	if i == 2 or cnt.most_common(1)[0][1] > 1:
		mpos = cnt.most_common(1)[0][0]
		used = [1] + [0] * (n - 1)
		for j in idx[mpos]:
			used[j] = 1
		points = [points[j] for j in range(n) if not used[j]]
		break
if len(points) <= 2:
	print('YES')
	exit()
cnt = Counter()
for (j, (x2, y2)) in enumerate(points):
	if i == j:
		continue
	(dx, dy) = (points[0][0] - x2, points[0][1] - y2)
	if dy == 0:
		dx = 1
	elif dx == 0:
		dy = 1
	elif dy < 0:
		(dx, dy) = (-dx, -dy)
	g = gcd(abs(dx), abs(dy))
	dx //= g
	dy //= g
	cnt[dx, dy] += 1
if cnt.most_common(1)[0][1] + 1 == len(points):
	print('YES')
else:
	print('NO')


def is_linear(A, B, C):
	return (B[0] - A[0]) * (C[1] - A[1]) == (C[0] - A[0]) * (B[1] - A[1])

def is_line(pos):
	if len(pos) <= 2:
		return True
	(A, B) = (P[pos[0]], P[pos[1]])
	for p in pos[2:]:
		if is_linear(A, B, P[p]) == False:
			return False
	return True

def check(A, B, used):
	for (i, p) in enumerate(P):
		if is_linear(A, B, p) == True:
			used[i] = 1

def refresh():
	for i in range(n):
		used[i] = 0
n = int(input())
P = [list(map(int, input().split())) for _ in range(n)]
if n <= 3:
	print('YES')
else:
	used = [0] * n
	flg = 'NO'
	for i in range(3):
		(A, B) = (P[i], P[(i + 1) % 3])
		check(A, B, used)
		pos = [i for (i, x) in enumerate(used) if x == 0]
		if is_line(pos) == True:
			flg = 'YES'
		refresh()
	print(flg)


def is_line(b):
	if len(b) < 3:
		return True
	x1 = b[0][0]
	y1 = b[0][1]
	for i in range(len(b)):
		b[i][0] -= x1
		b[i][1] -= y1
	x2 = b[1][0]
	y2 = b[1][1]
	for i in range(2, len(b)):
		if x2 * b[i][1] != y2 * b[i][0]:
			return False
	return True

def main():
	n = int(input())
	if n < 5:
		print('YES')
		return
	a = []
	for i in range(n):
		(x, y) = map(int, input().split())
		a.append([x, y])
	for i1 in range(3):
		x0 = a[i1][0]
		y0 = a[i1][1]
		for i in range(n):
			a[i][0] -= x0
			a[i][1] -= y0
		if i1 == 0:
			i2 = 1
			x1 = a[1][0]
			y1 = a[1][1]
		elif i1 == 1:
			i2 = 2
			x1 = a[2][0]
			y1 = a[2][1]
		else:
			i2 = 0
			x1 = a[0][0]
			y1 = a[0][1]
		b = []
		for i in range(n):
			if i != i1 and i != i2:
				if x1 * a[i][1] != y1 * a[i][0]:
					b.append([a[i][0], a[i][1]])
		if is_line(b):
			print('YES')
			return
	print('NO')
main()


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def ff(p, q, pp):
	npp = []
	for r in pp:
		if (p[1] - r[1]) * (p[0] - q[0]) != (p[1] - q[1]) * (p[0] - r[0]):
			npp.append(r)
	if len(npp) <= 2:
		return True
	a = npp[0]
	b = npp[1]
	for c in npp:
		if (a[1] - c[1]) * (a[0] - b[0]) != (a[1] - b[1]) * (a[0] - c[0]):
			return False
	return True

def main():
	n = int(input())
	if n <= 4:
		print('YES')
		return
	pp = []
	for _ in range(n):
		(a, b) = [int(x) for x in input().split()]
		pp.append((a, b))
	if ff(pp[0], pp[1], pp) or ff(pp[1], pp[2], pp) or ff(pp[0], pp[2], pp):
		print('YES')
	else:
		print('NO')
main()