#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<queue>
#include<vector>
#include<utility>
#include<functional>
typedef long long ll;
using namespace std;
typedef pair<int,int> p;
int main(){
  int sum=0;
  p path[3];
  for(int i=0;i<3;i++){
    int tmp,tmp2;
    cin >> tmp >> tmp2;
    path[i].first = tmp;
    path[i].second = tmp2;
  }
  for(int i=0;i<3;i++){
    int isPathed[5]={};
    isPathed[path[i].first]++;
    isPathed[path[i].second]++;
    int s = path[i].first;
    int t = path[i].second;
    for(int j=0;j<3;j++){
      if(j==i){
        continue;
      }
      for(int k=1;k<5;k++){
        if(k!=s && k!=t){
          isPathed[k]=0;
        }
      }
      if(path[i].second == path[j].first || path[i].second == path[j].second){
        if(path[i].second == path[j].first){
          isPathed[path[j].second]++;
          for(int k=0;k<3;k++){
            if(k!=i && k!=j){
              if(path[j].second == path[k].first){
                isPathed[path[k].second]++;
              }else if(path[j].second == path[k].second){
                isPathed[path[k].first]++;
              }

              //sum
              sum=0;
              for(int m=1;m<5;m++){
                sum+=isPathed[m];
              }
              if(sum==4){
                cout << "YES" << endl;
                return 0;
              }else{
              }
            }
          }
        }else if(path[i].second == path[j].second){
          isPathed[path[j].first]++;
          for(int k=0;k<3;k++){
            if(k!=i && k!=j){
              if(path[j].first == path[k].first){
                isPathed[path[k].second]++;
              }else if(path[j].first == path[k].second){
                isPathed[path[k].first]++;
              }

              //sum
              sum=0;
              for(int m=1;m<5;m++){
                sum+=isPathed[m];
              }
              if(sum==4){
                cout << "YES" << endl;
                return 0;
              }else{
              }
            }
          }
        }
      }
    }
  }
  
  for(int i=0;i<3;i++){
    int isPathed[5]={};
    isPathed[path[i].second]++;
    isPathed[path[i].first]++;
    int s = path[i].second;
    int t = path[i].first;
    for(int j=0;j<3;j++){
      if(j==i){
        continue;
      }
      for(int k=1;k<5;k++){
        if(k!=s && k!=t){
          isPathed[k]=0;
        }
      }
      if(path[i].first == path[j].first || path[i].first == path[j].second){
        if(path[i].first == path[j].first){
          isPathed[path[j].second]++;
          for(int k=0;k<3;k++){
            if(k!=i && k!=j){
              if(path[j].second == path[k].first){
                isPathed[path[k].second]++;
              }else if(path[j].second == path[k].second){
                isPathed[path[k].first]++;
              }

              //sum
              sum=0;
              for(int m=1;m<5;m++){
                sum+=isPathed[m];
              }
              if(sum==4){
                cout << "YES" << endl;
                return 0;
              }else{
              }
            }
          }
        }else if(path[i].first == path[j].second){
          isPathed[path[j].first]++;
          for(int k=0;k<3;k++){
            if(k!=i && k!=j){
              if(path[j].first == path[k].first){
                isPathed[path[k].second]++;
              }else if(path[j].first == path[k].second){
                isPathed[path[k].first]++;
              }

              //sum
              sum=0;
              for(int m=1;m<5;m++){
                sum+=isPathed[m];
              }
              if(sum==4){
                cout << "YES" << endl;
                return 0;
              }else{
              }
            }
          }
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256