for(b=[a=[o=i='']];l=readline(i++);)for(j=0;v=/\S+/g(l);b[k]=!(i-j))a[k=++j+9*i]=+v for(i=0;i++<9;){q=9*i for(j=i;!a[9*j+i];)j++ for(h=k=n=r=0;k++<9;b[m]=d)c=a[l=q+k],d=b[l],a[l]=a[m=9*j+k],b[l]=b[m],a[m]=c for(v=a[q+i];n++<9;b[k]/=v)a[k=q+n]/=v for(;h++<9;r=0)for(c=a[9*h+i];h-i&&r++<9;b[l]-=c*b[m])a[l=9*h+r]-=c*a[m=q+r]}for(;i<99;i++%9||(print(o),o=''))o+=(o&&' ')+(/737/(v=Math.round(b[i]))?v+2:/601/(v)?v+1:/090/(v)?v-1:v)