#include <bits/stdc++.h>
using namespace std;
ifstream f("date.in");
int v[8], a[8], s;
bool ok, was;
void seesum() {
  int s1 = 0;
  for (int i = 1; i <= 3; i++) s1 += a[v[i]];
  if (s - s1 == s1) ok = 1;
}
bool check(int k) {
  for (int i = 1; i < k; i++)
    if (v[i] == v[k]) return false;
  return true;
}
void bk(int k) {
  for (int i = 1; i <= 6; i++) {
    v[k] = i;
    if (check(k))
      if (k == 3) {
        seesum();
        if (ok && !was) {
          cout << "YES";
          was = 1;
          return;
        }
      } else if (k < 3)
        bk(k + 1);
  }
}
int main() {
  for (int i = 1; i <= 6; i++) {
    cin >> a[i];
    s += a[i];
  }
  bk(1);
  if (!was) cout << "NO";
}
