#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a[6];
  int n = 6;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int sm = a[0] + a[1] + a[2] + a[3] + a[4] + a[5];
  for (int mask = 0; mask < (1 << 6); mask++) {
    int cnt1 = 0, sm1 = 0;
    for (int j = 0; j < 6; j++) {
      if ((mask >> j) & 1) {
        ++cnt1;
        sm1 += a[j];
      }
    }
    if (cnt1 == 3 && sm1 == sm - sm1) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
}
