#include<stdio.h>

void search(int a[100][100],int,int);

main(){
  int data[100][100],a[100][100],temp,from,to,max=0;
  int i,j;

  //initialization
  for(i=0;i<100;i++){
    for(j=0;j<100;j++)data[i][j]=0;
  }
  max=0;



  while(1){
    scanf("%d %d",&from,&to);
    if (from==0&& to == 0)break;
    data[from][to]++;
    data[to][from]++;
    if (from > to)temp=from;
    else temp=to;
    if (temp > max)max=temp;   
  }

  


  for(i=2;i<max;i++){
    if (data[1][i]!=0){
      for(i=0;i<100;i++){
        for(j=0;j<100;j++)a[i][j]=data[i][j];
      }
      a[1][i]--;
      search(a,i,max);
    }
  

  }

  return 0;
}


void search(int a[100][100],int from,int max){
  int i,j,b[100][100];
  

  
  
  for(i=2;i<max;i++){
    if (a[from][i]!=0){
      if (i==2){printf("YES");return;}
      for(i=0;i<100;i++){
        for(j=0;j<100;j++)b[i][j]=a[i][j];
      }
      b[from][i]--;
      search(b,i,max);
    }
  }
  
  return;

}