Problem:
Score: 300 points

Problem Statement

We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.

According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.

Determine if he is correct.

Constraints

c_{i, j} \ (1 \leq i \leq 3, 1 \leq j \leq 3) is an integer between 0 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:

c_{1,1} c_{1,2} c_{1,3}
c_{2,1} c_{2,2} c_{2,3}
c_{3,1} c_{3,2} c_{3,3}

Output

If Takahashi's statement is correct, print Yes; otherwise, print No.

Sample Input 1

1 0 1
2 1 2
1 0 1

Sample Output 1

Yes

Takahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.

Sample Input 2

2 2 2
2 1 2
2 2 2

Sample Output 2

No

Takahashi is incorrect in this case.

Sample Input 3

0 8 8
0 8 8
0 8 8

Sample Output 3

Yes

Sample Input 4

1 8 6
2 9 7
0 7 7

Sample Output 4

No

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#pragma comment(linker, "/STACK:102400000,102400000")
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define Key_Value ch[ch[root][1]][0]
#define DBN1(a)           cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b)         cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c)       cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d)     cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e)   cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN6(a,b,c,d,e,f) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<", "<<#f<<"="<<(f)<<"\n"
#define clr(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define mp make_pair
#define ALL(x) x.begin(),x.end()
#define F first
#define S second
using namespace std;
typedef long long ll;
const int maxn=500000+5;
const int INF=0x3f3f3f3f;
const int P=1000000007;
const double PI=acos(-1.0);
template<typename T>
inline T read(T&x){
    x=0;int _f=0;char ch=getchar();
    while(ch<'0'||ch>'9')_f|=(ch=='-'),ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x=_f?-x:x;
}
template <class T1, class T2>inline void gmax(T1 &a,T2 b){if (b>a) a=b;}
template <class T1, class T2>inline void gmin(T1 &a,T2 b){if (b<a) a=b;}
void up(int&x,int y){x+=y;if(x>=P)x-=P;}
/*int n,a;
int main(){
    read(n),read(a);
    if (a>=n) puts("Yes");
    else{
        for (int i=0;i<=a;i++){
            if ((n-i)%500==0) return puts("Yes"),0;
        }
        puts("No");
    }
    return 0;
}*/
/*int n,a[105];
int main(){
    read(n);
    for (int i=1;i<=n;i++) read(a[i]);
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    int ans=0;
    for (int i=1;i<=n;i+=2){
        ans+=a[i]-a[i+1];
    }
    printf("%d\n",ans);
    return 0;
}*/
int c[4][4];
int main(){
    int ans=0;
    for (int i=1;i<=3;i++){
        for (int j=1;j<=3;j++){
            ans+=read(c[i][j]);
        }
    }
    if (ans%3!=0) puts("No");
    else{
        bool flag=true;
        int tmp;

        tmp=c[1][2]-c[1][1];
        for (int i=2;i<=3;i++){
            flag&=(tmp==c[i][2]-c[i][1]);
        }

        tmp=c[1][3]-c[1][2];
        for (int i=2;i<=3;i++){
            flag&=(tmp==c[i][3]-c[i][2]);
        }

        tmp=c[2][1]-c[1][1];
        for (int i=2;i<=3;i++){
            flag&=(tmp==c[2][i]-c[1][i]);
        }
        tmp=c[3][1]-c[2][1];
        for (int i=2;i<=3;i++){
            flag&=(tmp==c[3][i]-c[2][i]);
        }

        if (flag) puts("Yes");
        else puts("No");
    }
}