#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int arr[6];
  int sum = 0;
  for (int i = 0; i < 6; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  if (sum % 2 != 0) {
    cout << "NO" << '\n';
  } else {
    bool flag = false;
    for (int i = 0; i < 6; i++) {
      for (int j = i + 1; j < 6; j++) {
        for (int k = j + 1; k < 6; k++) {
          int s = arr[i] + arr[j] + arr[k];
          if (s == sum - s) {
            flag = true;
            break;
          }
        }
        if (flag == true) {
          break;
        }
      }
      if (flag == true) {
        break;
      }
    }
    if (flag == true) {
      cout << "YES" << '\n';
    } else {
      cout << "NO" << '\n';
    }
  }
}
