#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int s = 0;
  for (int i = 0; i < 6; i++) {
    int k;
    cin >> k;
    v.push_back(k);
    s += k;
  }
  for (int i = 0; i < 6; i++) {
    for (int j = i + 1; j < 6; j++) {
      for (int z = j + 1; z < 6; z++) {
        int d = v[i] + v[j] + v[z];
        if (d == s - d) {
          cout << "YES";
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
