#include using namespace std; #include using namespace atcoder; using ll = long long; using mint = modint998244353; int N; ll X[2 << 17]; ll Y[2 << 17]; ll ccw(int i, int j, int k) { ll xi = X[i] - X[j]; ll yi = Y[i] - Y[j]; ll xk = X[k] - X[j]; ll yk = Y[k] - Y[j]; ll cross = xk * yi - yk * xi; return cross == 0 ? 0 : cross / abs(cross); } ll dist(int i, int j) { ll xi = X[i] - X[j]; ll yi = Y[i] - Y[j]; return xi * xi + yi * yi; } pair tan(int i, int j) { ll dx = X[j] - X[i]; ll dy = Y[j] - Y[i]; ll g = gcd(dx, dy); return make_pair(dx / g, dy / g); } int find_pivot() { vector P(N); iota(P.begin(), P.end(), 0); auto it = min_element(P.begin(), P.end(), [&](int i, int j) { return X[i] == X[j] ? i < j : X[i] < X[j]; }); return it - P.begin(); } int main() { cin >> N; for(int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; } const int k = find_pivot(); map, int> cnt_tan; for(int i = 0; i < N; i++) { if(i == k) continue; cnt_tan[tan(k, i)]++; } set> st_many; for(auto [t, c] : cnt_tan) { if(c >= 2) st_many.insert(t); } if(ssize(cnt_tan) <= 1) { cout << "Yes" << endl; return 0; }else if(ssize(st_many) >= 1) { cout << "No" << endl; return 0; } vector P(N); iota(P.begin(), P.end(), 0); P.erase(P.begin() + k); sort(P.begin(), P.end(), [&](int i, int j) { ll res = ccw(i, k, j); ll di = dist(k, i); ll dj = dist(k, j); return res == 0 ? di < dj : res; }); if(ssize(st_many) == 1) { auto t = *st_many.begin(); auto tf = tan(k, P.front()); auto tb = tan(k, P.back()); cout << (t == tf) << endl; if(t == tb) { int x = N; while(x > 0 && tan(k, P[x - 1]) == t) x--; reverse(P.begin() + x, P.end()); }else if(t != tf) { cout << "No" << endl; return 0; } }else if(ssize(st_many) == 2) { auto t1 = *st_many.begin(); auto t2 = *st_many.rbegin(); auto tf = tan(k, P.front()); auto tb = tan(k, P.back()); if(t1 == tf && t2 == tb) { int x = N; while(x > 0 && tan(k, P[x - 1]) == t2) x--; reverse(P.begin() + x, P.end()); }else { cout << "No" << endl; } } P.push_back(k); for(int x = 0; x < N; x++) { int y = (x + 1) % N; int z = (x + 2) % N; if(ccw(x, y, z) != 1) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }