{ randa visus galimus sprendinius }
{ olimpiadoje buvo praðoma rasti bet kurá vienà sprendiná }
program gucikai_ir_kt;

  const PRAD='PLANET.DAT';
         REZ='PLANET.REZ';
        MAX = 500; { maksimalus vienos rûðies butybiø skaièius }
        DAL = 3;   { skirtingø kûno daliø skaièius }


  type Tmas = array [1..DAL] of integer;

  var f: text;

  procedure rasyti (guc_sk, muc_sk, fuc_sk: integer);
  begin
    writeln (f, guc_sk, ' ', muc_sk, ' ', fuc_sk);
  end; { rasyti }

  procedure skaiciuoti (bendr, guc, muc, fuc: Tmas;
                        var guc_sk, muc_sk, fuc_sk: integer);
    var g, m, t: integer;

  begin
    for m := 0 to MAX do
      for g := 0 to MAX do
         begin
          guc_sk := g; muc_sk := m;
          { tikriname rankas }
          t := bendr[1] - guc_sk*guc[1] - muc_sk*muc[1];
          if (t >= 0) and (t mod fuc[1] = 0) and (t div fuc[1] <= MAX) then
            begin { radome sveik1 skai2iu fuciku }
              fuc_sk := t div fuc[1];
              if  (guc_sk*guc[2]+muc_sk*muc[2]+fuc_sk*fuc[2]=bendr[2]) and
                  (guc_sk*guc[3]+muc_sk*muc[3]+fuc_sk*fuc[3]=bendr[3])
                   then  rasyti (guc_sk, muc_sk, fuc_sk);
           end;
      end;
  end; { skaièiuoti }

  procedure skaityti (var bendr, guc, muc, fuc: Tmas);
    var f: text;
  begin
   assign (f, PRAD);
   reset (f);
   readln (f, bendr[1], bendr[2], bendr[3]);
   readln (f, guc[1], guc[2], guc[3]);
   readln (f, muc[1], muc[2], muc[3]);
   readln (f, fuc[1], fuc[2], fuc[3]);
   close (f);
  end; { skaityti }

  var bendr, guc, muc, fuc: Tmas;
      guc_sk, muc_sk, fuc_sk: integer;
begin
   skaityti (bendr, guc, muc, fuc);
   assign (f, REZ);
   rewrite (f);
   skaiciuoti (bendr, guc, muc, fuc, guc_sk, muc_sk, fuc_sk);
   close (f);
end.