#include <iostream>

using namespace std;

int main(){
  int tmp;
  int count[5];
  for(int i = 0;i < 5;i++) count[i]= 0;
  for(int i= 0;i < 6;i++){
    cin >> tmp;
    count[tmp]++;
    if(count[tmp] > 2){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
