#include <stdio.h>
#include <string.h>
int in[]={,,,,,,,,};
int s[];
int re[][];
int sum(int su[])
{
int i,re=;
for(i=;su[i];i++)
re+=su[i];
return re;
}
int main()
{
int i,j,k,count=;
memset(s,,sizeof(s));
int SUM = sum(in);
if(SUM/ != (float)SUM/9.0)
{
printf("wrong\n");
return ;
}
for(i=;i<;i++)
for(j=i+;j<;j++)
for(k=j+;k<;k++)
{
if(in[i]+in[j]+in[k] == (int)SUM/)
{
s[i]++;
s[j]++;
s[k]++;
count++;
}
}
if(count!=)
{
printf("wrong\n");
return ;
}
int flag=;
for(i=;i>=;i--)
{
if(s[i]==) re[][] = in[i];
if(s[i]== && flag==) { re[][] = in[i]; flag++; }
else if(s[i]== && flag==) { re[][] = in[i]; flag++; }
else if(s[i]== && flag==) { re[][] = in[i]; flag++; }
else if(s[i]== && flag==) { re[][] = in[i]; flag++; }
}
if(re[][]+re[][]+re[][]!=(int)SUM/)
{
int tmp;
tmp = re[][];
re[][] = re[][];
re[][] = tmp;
}
re[][] = (int)SUM/ - re[][] - re[][];
re[][] = (int)SUM/ - re[][] - re[][];
re[][] = (int)SUM/ - re[][] - re[][];
re[][] = (int)SUM/ - re[][] - re[][];
for(i=;i<;i++)
{
for(j=;j<;j++)
{
printf("%d ",re[i][j]);
}
printf("\n");
}
return ;
}