#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
P e[9000];
int vd[9000];
int a,b,cnt;
bool flg;

void dfs(int x,int c){
  //cout<<x<<endl;

  vd[x/2*2+1]=vd[x/2*2]=true;

  if(c==cnt/2&&(e[x].second==2))flg=1;

  for(int i=0;i<cnt;i++){

    if(vd[i]==true)continue;

    if(e[i].first==e[x].second||e[x].first==e[i].second)dfs(i,c+1);

  }


}

int main(){

  while(cin>>a>>b){
    cnt=0;
    e[cnt].first=a;   e[cnt].second=b;
    e[cnt+1].first=b; e[cnt+1].second=a;
    cnt+=2;
    while(cin>>a>>b){
      if(a==0&&b==0)break;
      e[cnt].first=a;   e[cnt].second=b;
      e[cnt+1].first=b; e[cnt+1].second=a;
      cnt+=2;
    }

    flg=false;



    for(int i=0;i<cnt;i++){
      if(e[i].first==1){
	for(int j=0;j<cnt;j++)vd[j]=false;
	dfs(i,1);

      }
    }
    
    if(flg)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    
  }
  return 0;
}