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