#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T power(T base, int p) {
  T f = 1;
  for (int i = 1; i <= p; i++) f *= base;
  return f;
}
template <typename T>
string NumberToString(T Number) {
  ostringstream ss;
  ss << Number;
  return ss.str();
}
int setbit(int N, int pos) { return N = N | (1 << pos); }
int resetbit(int N, int pos) { return N = N & ~(1 << pos); }
bool checkbit(int N, int pos) { return (bool)(N & 1 << pos); }
pair<long long int, long long int> extendedEuclid(long long int a,
                                                  long long int b) {
  if (b == 0) return pair<long long int, long long int>(1, 0);
  pair<long long int, long long int> d = extendedEuclid(b, a % b);
  return pair<long long int, long long int>(d.second,
                                            d.first - d.second * (a / b));
}
long long int modularInverse(long long int a, long long int m) {
  pair<long long int, long long int> ret = extendedEuclid(a, m);
  return ((ret.first % m) + m) % m;
}
int main() {
  int n;
  while (cin >> n) {
    int a, b, c, p, q, r;
    cin >> a >> p;
    cin >> b >> q;
    cin >> c >> r;
    int m3 = c, m2 = b, m1 = n - (b + c);
    while (m1 > p) {
      m1--;
      if (m2 != q) {
        m2++;
      } else {
        m3++;
      }
    }
    cout << m1 << " " << m2 << " " << m3 << endl;
    ;
  }
}
