#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a[4],b[4],c[4],rec[4];
void dfs(int deep,int rest,int ga,int gb,int gc)
{
int i;
if (deep==3)
{
bool flag=true;
rec[3]=rest;
ga+=rest*a[3];
gb+=rest*b[3];
gc+=rest*c[3];
if (a[0]!=0)
if (ga%a[0]!=0)
flag=false;
if (b[0]!=0)
if (gb%b[0]!=0)
flag=false;
if (c[0]!=0)
if (gc%c[0]!=0)
flag=false;
if (flag)
{
if (a[0])
i=ga/a[0];
else
{
if (b[0])
i=gb/b[0];
else
i=gc/c[0];
}
if (i*b[0]==gb&&i*c[0]==gc)
{
cout<<rec[1]<<' '<<rec[2]<<' '<<rec[3]<<' '<<i<<endl;
exit(0);
}
}
return;
}
for (i=0;i<=rest;i++)
{
rec[deep]=i;
dfs(deep+1,rest-i,ga+i*a[deep],gb+i*b[deep],gc+i*c[deep]);
}
}
int main(void)
{
freopen("ratios.in","r",stdin);
freopen("ratios.out","w",stdout);
int i;
for (i=0;i<=3;i++)
cin>>a[i]>>b[i]>>c[i];
if (a[0]==0&&b[0]==0&&c[0]==0)
cout<<"0 0 0 0\n";
for (i=1;i<=600;i++)
dfs(1,i,0,0,0);
cout<<"NONE\n";
return(0);
}