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