#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int x=9;
int total;
bool no=0;
int a[x][x];
while (true)
{
total = 0;
no = 0;
/* 開始儲存9 * 9陣列的值 */
for (int i = 0; i < x; i++)
{
for (int j = 0; j < x; j++)
{
if (cin >> a[i][j])
{
;
}
else
{
goto END;
}
}
}
//judje(1)------------------------
for (int i = 0; i < x; i++)
{
for (int j = 0; j < x; j++)
{
total+=a[i][j];
}
}
if(total!=45)
{
no=1;
}
total=0;
//judje(2)------------------------
for (int i = 0; i < x; i++)
{
for (int j = 0; j < x; j++)
{
total+=a[j][i];
}
}
if(total!=45)
{
no=1;
}
total=0;
//judje方塊------------------------
for (int i = 0; i < 9; i+=3)
{
for (int j = 0; j < 9; j+=3)
{
for (int k = i; k < i+3; k++)
{
for (int l =j; l <j+3; l++)
{
total+=a[k][l];
}
}
}
}
if(total!=45)
{
no=1;
}
total=0;
//cout no/yes---------------------
if(no!=0)
{
cout<<"no"<<endl;
}
else
{
cout<<"yes"<<endl;
}
}
END:
return 0;
}