#include <bits/stdc++.h>
using namespace std;
int num[300005];
void qs(int *s_arr, int first, int last) {
  if (first < last) {
    int left = first, right = last, middle = s_arr[(left + right) / 2];
    do {
      while (s_arr[left] < middle) left++;
      while (s_arr[right] > middle) right--;
      if (left <= right) {
        int tmp = s_arr[left];
        s_arr[left] = s_arr[right];
        s_arr[right] = tmp;
        swap(num[left], num[right]);
        left++;
        right--;
      }
    } while (left <= right);
    qs(s_arr, first, right);
    qs(s_arr, left, last);
  }
}
int main() {
  int n;
  int x1;
  int x2;
  int c[300005];
  int sum = 0;
  for (int i = 0; i < 6; i++) {
    cin >> c[i];
    sum += c[i];
  }
  bool ok = false;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 6; j++) {
      for (int k = 0; k < 6; k++) {
        if (c[i] + c[j] + c[k] == sum / 2 && i != j && i != k && j != k) {
          ok = true;
        }
      }
    }
  }
  if (ok && sum % 2 == 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
