const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const list1 = input.split('\n')[0].split(' ');

const list2 = input.split('\n')[1].split(' ');

const list3 = input.split('\n')[2].split(' ');

const list = list1.concat(list2).concat(list3);

const targetList = [1, 2, 3, 4];

const one = list.indexOf('1');
const two = list.indexOf('2');
const three = list.indexOf('3');
const four = list.indexOf('4')

const output = () => {
  if (one === -1 || two === -1 || three === -1 || four === -1) {
    console.log('NO');
  } else {
    list.splice(one, 1, 0);
    list.splice(two, 1, 0);
    list.splice(three, 1, 0);
    list.splice(four, 1, 0);

    var arr = list.filter(e => e !== 0);

    if (arr[0] === arr[1]) {
      console.log('NO');
    } else {
      console.log('YES')
    }
  }
};

output();
