#include<stdio.h>
#define SIZE 3
int main(void) {
int m, n, p1, q1, p2, q2, p3, q3, o, x, y, z, s = 0, d = 0, f = 0, g = 0,w1,e1,w2,e2,w3,e3;
int sum = 0;
int a[SIZE][SIZE];
for (m = 0; m < 3; m++) {
for (n = 0; n < 3; n++) {
scanf("%d", &a[m][n]);
}
}
scanf("%d %d", &w1, &e1);
scanf("%d %d", &w2, &e2);
scanf("%d %d", &w3, &e3);
p1 = w1-1, q1 = e1-1, p2 = w2-1, q2 = e2-1, p3 = w3-1, q3 = e3-1;
printf("%d\n", a[p1][q1]);
printf("%d\n", a[p2][q2]);
printf("%d\n", a[p3][q3]);
x = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9) - (a[0][0] + a[0][1] + a[0][2] + a[1][0] + a[1][1] + a[1][2] + a[2][0] + a[2][1] + a[2][2]);
for (m = 0; m < SIZE; m++) {
for (n = 0; n < SIZE; n++) {
if (a[m][n] == 0) {
如果该数字为0
y = m;
z = n;
break;
}
}
}
a[y][z]=x;被记录的位置为未知数
scanf("%d", &o);
switch (o) {
case 2:
sum += (a[1][0] + a[1][1] + a[1][2]);
break;
case 3:
sum += (a[2][0] + a[2][1] + a[2][2]);
break;
break;
case 1:
sum += (a[0][0] + a[0][1] + a[0][2]);
break;
case 5:
sum += (a[0][1] + a[1][1] + a[2][1]);
break;
case 6:
sum += (a[0][2] + a[1][2] + a[2][2]);
break;
case 4:
sum += (a[0][0] + a[1][0] + a[2][0]);
break;
case 7:
sum += (a[0][0] + a[1][1] + a[2][2]);
break;
case 8:
sum += (a[0][2] + a[1][1] + a[2][0]);
break;
}
int k[19][2] = {
{
6,10000},
{
16,72},
{
7,36},
{
17,180},
{
8,720},
{
18,119},
{
9,360},
{
19,36},
{
10,80},
{
20,306},
{
11,252},
{
21,1080},
{
12,108},
{
22,144},
{
13,72},
{
23,1800},
{
14,54},
{
24,3600},
{
15,180}
};
for(int i=0;i<19;i++){
if(k[i][0]==sum){
printf("%d", k[i][1]);
break;
}
if(i==18&&k[i][0]!=sum)
printf("0");
}
return 0;
}