#include <bits/stdc++.h>
using namespace std;
bool nemu = false, flag[10];
int slot[10], total;
vector<int> nilai;
void rek(int idx) {
  if (nemu) return;
  if (idx == 3) {
    if (slot[0] + slot[1] + slot[2] == total / 2) nemu = true;
  } else {
    for (int i = 0; i < 6; i++) {
      if (flag[i] == false) {
        slot[idx] = nilai[i];
        flag[i] = true;
        rek(idx + 1);
        flag[i] = false;
      }
    }
  }
}
int main() {
  int hm;
  total = 0;
  for (int i = 0; i < 6; i++) {
    cin >> hm;
    total += hm;
    nilai.push_back(hm);
  }
  rek(0);
  if (total % 2 == 1) nemu = false;
  if (nemu)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
