#include <bits/stdc++.h>
using namespace std;
int main() {
  int ar[6];
  int total = 0;
  for (int i = 0; i < 6; i++) {
    cin >> ar[i];
    total += ar[i];
  }
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 5; j++) {
      for (int k = j + 1; k < 6; k++) {
        if ((ar[i] + ar[j] + ar[k]) == (total - (ar[i] + ar[j] + ar[k]))) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
}
