#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int a[5], b[5], c[5], ta, tb, tc,bi;
int main()
{
scanf("%d%d%d", &a[0], &b[0], &c[0]);
for (int i = 1; i <= 3; i++)
scanf("%d%d%d", &a[i], &b[i], &c[i]);
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
for (int k = 0; k < 100; k++)
{
ta = i * a[1] + j * a[2] + k * a[3];
tb = i * b[1] + j * b[2] + k * b[3];
tc = i * c[1] + j * c[2] + k * c[3];
bi = 0;
if (a[0] != 0)
bi = ta / a[0];
if (b[0] != 0)
if (bi == 0)
bi = tb / b[0];
else
if (bi != tb / b[0])
continue;
if (c[0] != 0)
if (bi == 0)
bi = tc / c[0];
else
if (bi != tc / c[0])
continue;
if (bi != 0 && a[0] * bi == ta && b[0] * bi == tb && c[0] * bi == tc)
{
printf("%d %d %d %d\n", i, j, k,bi);
return 0;
}
}
printf("NONE\n");
return 0;
}