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]

Difficulty: interview

Starter code:

Solutions:
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")


n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    xi, yi = list(map(int, input().split()))
    x[i], y[i] = xi, yi

if n <= 4:
    print("YES"); return

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"); return
f = df[0]

df2 = diff(0, f)
if check(df2):
    print("YES"); return

df3 = diff(1, f)
if check(df3):
    print("YES"); return

print("NO")
        

    



#!/usr/bin/env python3

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 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)


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]
##    for p1, p2 in combinations(p5, 2):
##        print(p1, p2, line(p1, p2), nb_points(line(p1, p2), p5))
    lines = set(line(p1, p2) for p1, p2 in combinations(p5, 2))
##    for l in lines:
##        print(l, nb_points(l, p5))
    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
    else:
        if b == 0:
            if c == 0:
                a = 1
            else:
                g = abs(gcd(a, c))
                a, c = a // g, c // g
        else:
            if 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()


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

def __starting_point():
    n = int(input())
    points = [
        tuple(map(int, input().split()))
        for _ in range(n)
    ]
    print("YES" if solution(points) else "NO")

__starting_point()

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()




	

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')
	
	


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')
    return

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')
        return

    C = Counter(v_s)

    p_max, p_max_ = sorted(list(C.items()), key=lambda x: x[1])[-1]

    if time() - t > 1.75:
        print('NO')
        return

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')
    return

p_ = choice(points_)

v_s_ = [get_v(p_, x) for x in points_ if x != p_]

if len(set(v_s_)) >= 2:
    print('NO')
    return

print('YES')


R = lambda: list(map(int, input().split()))

n = int(input())
ps = []

def ff(a, b):
    pp = [] # left points
    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')
else:
    if ff(ps[0], ps[1]) or ff(ps[0], ps[2]) or ff(ps[1], ps[2]):
        print('YES')
    else:
        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]
##    for p1, p2 in combinations(p5, 2):
##        print(p1, p2, line(p1, p2), nb_points(line(p1, p2), p5))
    lines = set(line(p1, p2) for p1, p2 in combinations(p5, 2))
##    for l in lines:
##        print(l, nb_points(l, p5))
    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
    else:
        if b == 0:
            if c == 0:
                a = 1
            else:
                g = abs(gcd(a, c))
                a, c = a // g, c // g
        else:
            if 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()

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):
        # print("return sub", self)
        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):
    nonlocal 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):
    nonlocal 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():
    nonlocal 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()

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')

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')
    return
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")
    #print(1,p)
    return
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])
        #print('here in 2 ',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(2,p)
    #print(a1,b1,c1,a2,b2,c2)
    print("YES")
    return
    
    

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")
    #print(3,p)
    return
print("NO")

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")


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
            else:
                # kx = (p[0] - first[0]) / dx
                # ky = (p[1] - first[1]) / dy
                # if math.isclose(kx, ky):
                #     st[i] = True
                if ((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()

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)
            else:
                if 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')



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")
    return

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")


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')


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): # erase all points collinear with a, b
        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)): # check if remaining points are all collinear
            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())

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 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()