#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long arr[6], sum = 0;
  for (int i = 0; i < 6; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  for (int i = 0; i < 6; i++)
    for (int j = i + 1; j < 6; j++)
      for (int k = j + 1; k < 6; k++) {
        if ((arr[i] + arr[j] + arr[k]) * 2 == sum) {
          cout << "YES";
          return 0;
        }
      }
  cout << "NO";
  return 0;
}
