#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>


using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 998244353;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;

long long int N,K,A[300000]={},B[300000],res=0;
long long int dp[3005][6005]={},memo[3005]={};
int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    for (long long int  i = 0; i < N; i++)
    {
        cin>>A[i]>>B[i];
    }
    for (long long int i = 0; i < N; i++)
    {
        for (long long int j = i+1; j < N; j++)
        {
            for (long long int k = j+1; k < N; k++)
            {
                if((B[j]-B[i])*(A[k]-A[i])==(B[k]-B[i])*(A[j]-A[i])){
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
            
        }
        
    }
    cout<<"No"<<endl;
    
    
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(int a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
int main(void)
{
  int N=IN(),A=0,B=0,sz=2*N,tp[sz]={},com[sz];short dp[sz+1]={};
  memset(com,-1,sizeof(com));
  rep(i,N)
  {
    A=IN(),B=IN();
    if(A!=-1){A--;if(tp[A]){return puts("No"),0;}tp[A]=i+1;}
    if(B!=-1){B--;if(tp[B]){return puts("No"),0;}tp[B]=-i-1;}
    if(A!=-1&&B!=-1){com[A]=B;com[B]=A;}
  }
  dp[0]=1;
  rep(i,sz)
  {
    if(!dp[i])continue;
    rep(j,sz-i-1)
    {
      int w=j+2;if(w&1){continue;}else w/=2;
      short ok=1,exist[N]={};
      rep(k,w)
      {
        int p=i+k,q=i+k+w;short same=1;
        if(com[p]!=-1&&!(i<=com[p]&&com[p]<=i+j+1)){ok=0;break;}
        if(com[q]!=-1&&!(i<=com[q]&&com[q]<=i+j+1)){ok=0;break;}
        if(tp[p]!=0&&tp[q]!=0){if(tp[p]<0||tp[p]+tp[q]!=0){ok=0;break;}else same=1;}
        if(tp[p]<0||tp[q]>0){ok=0;break;}
        else
        {
          if(tp[p]!=0){int v=tp[p]-1;if(exist[v]){ok=0;break;}exist[v]=1;}
          if(!same&&tp[q]!=0){int v=-tp[q]-1;if(exist[v]){ok=0;break;}exist[v]=1;}
        }
      }
      if(ok)dp[i+j+2]=1;
    }
  }
  return puts(dp[sz]?"Yes":"No"),0;
}