#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, x, testCase;
  long long int sum = 0, arr[7];
  for (int i = 0; i < 6; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  bool ans = false;
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j <= 4; j++) {
      for (int k = j + 1; k <= 5; k++) {
        if ((arr[i] + arr[j] + arr[k]) * 2 == sum) ans = true;
      }
    }
  }
  cout << (ans == true ? "YES" : "NO") << endl;
}
