#include <bits/stdc++.h>
using namespace std;
int main() {
  bool flag = false;
  vector<int> a(6);
  vector<bool> m(6, true);
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 6; ++i) {
    for (int j = i + 1; j < 6; ++j) {
      for (int z = j + 1; z < 6; ++z) {
        m[i] = false;
        m[j] = false;
        m[z] = false;
        int s = 0;
        for (int l = 0; l < 6; l++)
          if (m[l]) s += a[l];
        if (a[i] + a[j] + a[z] == s) {
          flag == true;
          cout << "YES";
          return 0;
        }
        m[i] = true;
        m[j] = true;
        m[z] = true;
        s = 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
