import java.util.*;
import java.io.*;

public class Main275A
{
  static PrintWriter out=new PrintWriter(System.out);
  static boolean valid(int i,int j)
  {
    return i>=0&&i<=2&&j>=0&&j<=2;
  }

  public static void main(String[] args) throws IOException
  {
    Scanner sc=new Scanner(System.in);

    int[][] a=new int[3][3];
    int[][] b=new int[3][3];
    for(int i=0;i<3;i++)
    {
      for(int j=0;j<3;j++)
      {
        a[i][j]=sc.nextInt();
        b[i][j]=a[i][j];
      }
    }
    for(int i=0;i<3;i++)
    {
      for(int j=0;j<3;j++)
      {
        if(valid(i-1,j))
          b[i-1][j]+=a[i][j];
        if(valid(i+1,j))
          b[i+1][j]+=a[i][j];
        if(valid(i,j-1))
          b[i][j-1]+=a[i][j];
        if(valid(i,j+1))
          b[i][j+1]+=a[i][j];
      }
    }
    for(int i=0;i<3;i++)
    {
      for(int j=0;j<3;j++)
      {
        if(b[i][j]%2==0)
          out.print(1);
        else
          out.print(0);
      }
      out.println();
    }
    out.flush();

  }
  static class Scanner
  {
    BufferedReader br;
    StringTokenizer tk=new StringTokenizer("");
    public Scanner(InputStream is)
        {
      br=new BufferedReader(new InputStreamReader(is));
    }
        public int nextInt() throws IOException
        {
          if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
          tk=new StringTokenizer(br.readLine());
          return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
              return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
          if(tk.hasMoreTokens())
            return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
          tk=new StringTokenizer("");
          return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
              return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
              return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
          long a[]=new long[n];
            for(int i=0;i<n;i++)
              a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
          int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
              a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
          long a[]=new long[n+1];
          for(int i=1;i<=n;i++)
                a[i]=nextLong();
          return a;
        }
  }
}

import java.util.*;
import java.lang.*;

public class Codeforces {

    private static int[][] T = new int[5][5];

    public static void main(String[] args){
        read();
        solve();
    }

    private static void read(){
        Scanner in = new Scanner(System.in);

        for(int i=1;i<4;i++){
            for(int j=1;j<4;j++){
                int val = in.nextInt();
                T[i][j]+=val;
                T[i+1][j]+=val;
                T[i-1][j]+=val;
                T[i][j+1]+=val;
                T[i][j-1]+=val;
            }
        }

        in.close();
    }

    private static void solve(){
        for(int i=1;i<4;i++){
            for(int j=1;j<4;j++){
                System.out.print(1-T[i][j]%2);
            }

            System.out.println();
        }
    }
}

import java.util.*;

public class A275
{
    static int[] dx = {0, 0, -1, 1};
    static int[] dy = {-1, 1, 0, 0};

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        boolean[][] g = new boolean[3][3];
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                int cur = in.nextInt() % 2;
                if (cur == 0)
                    continue;
                g[i][j] = !g[i][j];

                for (int k = 0; k < dx.length; k++)
                {
                    int ni = i + dx[k];
                    int nj = j + dy[k];
                    if (ni < 0 || nj < 0 || ni >= 3 || nj >= 3)
                        continue;
                    g[ni][nj] = !g[ni][nj];
                }
            }
        }

        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
                System.out.print(g[i][j] ? "0" : "1");
            System.out.println();
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * User: dima
 * Date: 20.02.13
 * Time: 18:54
 * To change this template use File | Settings | File Templates.
 */
public class TaskA {
    public static int[] mi = {0, -1, 1, 0, 0};
    public static int[] mj = {1, 0, 0, -1, 0};
    static BufferedReader in = new BufferedReader(new InputStreamReader(
            System.in));
    static StringTokenizer str;
    static String SK;

    static String next() throws IOException {
        while ((str == null) || (!str.hasMoreTokens())) {
            SK = in.readLine();
            if (SK == null)
                return null;
            str = new StringTokenizer(SK);
        }
        return str.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static int[][] made(int i, int j, int[][] t) {
        for (int ii = 0; ii < 5; ii++) {
            if (i + mi[ii] >= 3 || i + mi[ii] < 0) continue;
            if (j + mj[ii] >= 3 || j + mj[ii] < 0) continue;
            if (t[i + mi[ii]][j + mj[ii]] == 1) t[i + mi[ii]][j + mj[ii]] = 0;
            else t[i + mi[ii]][j + mj[ii]] = 1;
        }
        return t;
    }

    public static void main(String[] args) throws IOException {
        int[][] inin = new int[3][3];
        int[][] out = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                out[i][j] = 1;
                inin[i][j] = nextInt();
                inin[i][j] = inin[i][j] % 2;
            }
        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int cnt = inin[i][j];
                for (int ii = 0; ii < cnt; ii++) {
                    out = made(i, j, out);
                }
            }
        }

        String answ = "";
        for (int i = 0; i < 3; i++) {

            for (int j = 0; j < 3; j++) {
                answ += out[i][j];
            }
            System.out.println(answ);
            answ = "";
        }

    }
}

import java.util.*;
public class n1d
{
   public static void main (String args[])
   {
      Scanner in=new Scanner (System.in);
      int a[][]=new int[3][3];
      int b[][]=new int[3][3];
      int i,j,p,q,r,s;
      n1d ob=new n1d();
      for(i=0;i<3;i++)
      {
         for(j=0;j<3;j++)
         {
            a[i][j]=1;
            b[i][j]=in.nextInt();
         }
      }
      for(i=0;i<3;i++)
      {
         for(j=0;j<3;j++)
         {
            if(b[i][j]%2==0)
            continue;
            p=i+1;
            q=i-1;
            r=j-1;
            s=j+1;
            a[i][j]=ob.reverse(a[i][j]);
            if(p<3)
            a[p][j]=ob.reverse(a[p][j]);
            if(q>=0)
            a[q][j]=ob.reverse(a[q][j]);
            if(r>=0)
            a[i][r]=ob.reverse(a[i][r]);
            if(s<3)
            a[i][s]=ob.reverse(a[i][s]);
         }
      }
      for(i=0;i<3;i++)
      {
         for(j=0;j<3;j++)
            System.out.print(a[i][j]);
         System.out.println();
      }
   }
   int reverse(int x)
      {
         if(x==0)
         return 1;
         else
         return 0;
      }
}

import java.awt.datatransfer.StringSelection;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;

public class A {
    static Scanner in; static int next() throws Exception {return in.nextInt();};
    //	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
    static PrintWriter out;

    static void add(int a[][], int r, int c, int val) {
        if (r < 3&&r >= 0&&c < 3&&c >= 0) a[r][c] += val;
    }
    public static void main(String[] args) throws Exception {
        in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        int a[][] = new int[3][3];
        for (int i = 0;i < 3;i++) {
            for (int j = 0;j < 3;j++) {
                int c = next();
                a[i][j] += c;
                add(a,i-1,j,c);
                add(a,i+1,j,c);
                add(a,i,j-1,c);
                add(a,i,j+1,c);
            }
        }

        for (int i = 0;i < 3;i++) {
            for (int j = 0;j < 3;j++) out.print((a[i][j]+1)%2);
            out.println();
        }

        out.println();
        out.close();
    }
}

import java.util.Scanner;

public class Main {
public static void main(String... args) {

Scanner sc = new Scanner(System.in);
int n = 3;
boolean[][] t = new boolean[n][n];
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
  if (sc.nextInt()%2!=0){
    toggle(i,j,t);
    toggle(i+1,j,t);
    toggle(i-1,j,t);
    toggle(i,j+1,t);
    toggle(i,j-1,t);
  }
}}

for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
  System.out.print(t[i][j]?"0":"1");
}
System.out.println();
}
}

private static void toggle(int a, int b, boolean[][] t){
  try{t[a][b]=!t[a][b];}catch(Exception e){}
}
}

import java.util.*;
import java.io.*;

public class A {
	public static void main(String[] args) throws IOException
	{
		Scanner ins = new Scanner(System.in);//(new FileInputStream(new File("./input.txt")));
		PrintStream outs = System.out;

		int[][] a = new int[3][3];
		int[][] ans = new int[3][3];
		for (int i=0; i<3; i++)
			for (int j=0; j<3; j++) {
				a[i][j] = ins.nextInt();
				ans[i][j] = 1;
			}

		for (int i=0; i<3; i++) {
			for (int j=0; j<3; j++) {
				int tmp=0;
				switch(i*3+j) {
					case 0: tmp = a[0][0] + a[0][1] + a[1][0]; break;
					case 1: tmp = a[0][0] + a[0][1] + a[1][1] + a[0][2]; break;
					case 2: tmp = a[0][1] + a[0][2] + a[1][2]; break;
					case 3: tmp = a[0][0] + a[1][0] + a[1][1] + a[2][0]; break;
					case 4: tmp = a[1][0] + a[1][1] + a[1][2] + a[0][1] + a[2][1]; break;
					case 5: tmp = a[0][2] + a[1][1] + a[1][2] + a[2][2]; break;
					case 6: tmp = a[1][0] + a[2][0] + a[2][1]; break;
					case 7: tmp = a[1][1] + a[2][0] + a[2][1] + a[2][2]; break;
					case 8: tmp = a[1][2] + a[2][1] + a[2][2]; break;
				}
				if (tmp % 2 == 1) ans[i][j] = 0;
				outs.print(ans[i][j]);
			}
			outs.println();
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author dell
 */
public class cfp_1 {
    static int init[][];
    public static void main(String args[]) throws IOException{
        int arr [] []= new int[3][3];
         init = new int[3][3];
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         for(int i=0;i<3;i++){
             String l = br.readLine();
             String a [] = l.split(" ");
             for(int j=0;j<a.length;j++){
                 arr[i][j] = Integer.parseInt(a[j]);
                 init[i][j] =1;
                 //System.out.println(arr[i][j]+" "+init[i][j]);
             }
         }
         for(int i=0;i<3;i++){
             for(int j=0;j<3;j++){
                 int m = arr[i][j];
                 for(int a=0;a<m;a++){
                     if(j<2)flip(i,j+1);
                     if(j>0)flip(i,j-1);
                     if(i<2)flip(i+1,j);
                     if(i>0)flip(i-1,j);
                     flip(i,j);
                 }
             }
         }
         for(int i=0;i<3;i++){
             for(int j=0;j<3;j++){
                 System.out.print(init[i][j]);
             }
             System.out.println();
         }

    }
    public static void flip(int i,int j){
        if(init[i][j]==1) init[i][j]=0;
        else init[i][j]=1;
    }

}

import java.util.Scanner;

public class LightsOut_275A {

	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a[][] = new int[5][5];
		for (int i=1;i<=3;i++) {
			for(int j=1;j<=3;j++) {
				a[i][j]=sc.nextInt();
			}
		}
		for(int i=1;i<=3;i++) {
			for(int j=1;j<=3;j++) {
				if((a[i][j]+a[i-1][j]+a[i+1][j]+a[i][j+1]+a[i][j-1])%2==0) {
					System.out.print("1");
				}
				else {
					System.out.print("0");
				}
			}
			System.out.println();
		}
	}
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

import javax.net.ssl.SSLContext;

/**
 * Works good for CF
 */
public class A {

	//some local config
	static boolean test = false;
	static String testDataFile = "test.txt";
	static String feedFile = "feed.txt";
	CompetitionType type = CompetitionType.CF;
	private static String ENDL = "\n";

	// solutions

	private void solve() throws Throwable {
		int[] arr = new int[25];
		int[] ans = new int[25];
		for(int i = 6; i<9; i++){
			arr[i] = iread();
			if(arr[i] % 2 == 0){
				arr[i] = 0;
			}
			else{
				arr[i] = 1;
			}
		}
		for(int i = 11; i<14; i++){
			arr[i] = iread();
			if(arr[i] % 2 == 0){
				arr[i] = 0;
			}
			else{
				arr[i] = 1;
			}
		}
		for(int i = 16; i<19; i++){
			arr[i] = iread();
			if(arr[i] % 2 == 0){
				arr[i] = 0;
			}
			else{
				arr[i] = 1;
			}
		}

		for(int i = 6; i<19; i++){
			ans[i] = (arr[i]+arr[i+1]+arr[i-1]+arr[i+5]+arr[i-5]+1)%2;
		}

		System.out.println(ans[6] + "" + ans[7] + "" + ans[8]);
		System.out.println(ans[11] + "" + ans[12] + "" + ans[13]);
		System.out.println(ans[16] + "" + ans[17] + "" + ans[18]);
	}

	public int iread() throws Exception {
		return Integer.parseInt(wread());
	}

	public double dread() throws Exception {
		return Double.parseDouble(wread());
	}

	public long lread() throws Exception {
		return Long.parseLong(wread());
	}

	public String wread() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) throws Throwable {

		if(test){ //run all cases from testfile:
			BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));
			String readLine = testdataReader.readLine();
			int casenr = 0;
			out: while (true) {
				BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));
				if(!readLine.equals("input")){
					break;
				}
				while (true) {
					readLine = testdataReader.readLine();
					if(readLine.equals("output")){
						break;
					}
					w.write(readLine + "\n");
				}
				w.close();
				System.out.println("Answer on case "+(++casenr)+": ");

				new A().solve();
				System.out.println("Expected answer: ");

				while (true) {
					readLine = testdataReader.readLine();

					if(readLine == null){
						break out;
					}
					if(readLine.equals("input")){
						break;
					}
					System.out.println(readLine);
				}
				System.out.println("----------------");
			}
			testdataReader.close();
		} else { // run on server
			new A().solve();
		}
		out.close();
	}

	public A() throws Throwable {
		if (test) {
			in = new BufferedReader(new FileReader(new File(feedFile)));
		}
	}

	InputStreamReader inp = new InputStreamReader(System.in);
	BufferedReader in = new BufferedReader(inp);
	static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	enum CompetitionType {CF, OTHER};
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class A168 {

    public void solve() throws IOException {

        Scanner sc = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);

        int i = 0, j = 0, x = 0, y = 0;
        long ans = 0, sum = 0, count = 0;

        int aa[][] = new int[3][3];
        int sol[][] = new int[3][3];
        for (x = 0; x < 3; ++x) {
            for (y = 0; y < 3; ++y) {
                sol[x][y] = 1;
            }
        }

        for (i = 0; i < 3; ++i) {
            for (j = 0; j < 3; ++j) {
                aa[i][j] = sc.nextInt();
                if (aa[i][j] % 2 != 0) {
                    if (sol[i][j] == 0) {
                        sol[i][j] = 1;
                    } else {
                        sol[i][j] = 0;
                    }
                    if (i - 1 >= 0) {
                        if (sol[i - 1][j] == 0) {
                            sol[i - 1][j] = 1;
                        } else {

                            sol[i - 1][j] = 0;
                        }
                    }
                    if (i + 1 <= 2) {
                        if (sol[i + 1][j] == 0) {
                            sol[i + 1][j] = 1;
                        } else {
                            sol[i + 1][j] = 0;
                        }
                    }
                    if (j + 1 <= 2) {
                        if (sol[i][j + 1] == 0) {
                            sol[i][j + 1] = 1;
                        } else {
                            sol[i][j + 1] = 0;
                        }
                    }
                    if (j - 1 >= 0) {
                        if (sol[i][j - 1] == 0) {
                            sol[i][j - 1] = 1;
                        } else {
                            sol[i][j - 1] = 0;
                        }
                    }
                }

            }
        }
        for (x = 0; x < 3; ++x) {
            for (y = 0; y < 3; ++y) {
                System.out.print(sol[x][y]);
            }
            System.out.println("");
        }

    }

    public static void main(String[] args) throws IOException {
        new A168().solve();

    }
}

import java.awt.List;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.Vector;

public class Solution {

    /**
     * @param args
     * @throws IOException
     */

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
int n,m;
    Scanner Sc=new Scanner (System.in);
  int [][]Mass=new int[3][3];
  int [][]lamp=new int[3][3];
  for(int i=0; i<3; i++)
      for(int j=0; j<3; j++)
      {
          Mass[i][j]=Sc.nextInt()%2;
          lamp[i][j]=1;
      }

  for(int i=0; i<3; i++)
      for(int j=0; j<3; j++)
      {
          if(Mass[i][j]==1)
          {
              lamp[i][j]++;
              lamp[i][j]%=2;
              if(i-1>=0)
              {
                  lamp[i-1][j]++;
                  lamp[i-1][j]%=2;
              }
              if(j-1>=0)
              {
                  lamp[i][j-1]++;
                  lamp[i][j-1]%=2;
              }
              if(i+1<=2)
              {
                  lamp[i+1][j]++;
                  lamp[i+1][j]%=2;
              }
              if(j+1<=2)
              {
                  lamp[i][j+1]++;
                  lamp[i][j+1]%=2;
              }

          }
      }
  for(int i=0; i<3; i++)
  {
      for(int j=0; j<3; j++)
          System.out.print(lamp[i][j]);
      System.out.print("\n");
  }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Proba {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[][] = new int [5][5];
//      Arrays.fill(a, 1);
        for (int i = 1; i <=3; i++) {
            for (int j = 1; j <= 3; j++) {
                int x = sc.nextInt();
                a[i-1][j]+=x;
                a[i+1][j]+=x;
                a[i][j-1]+=x;
                a[i][j+1]+=x;
                a[i][j]+=x;
            }
        }
        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                System.out.print((a[i][j]%2==1)? "0":"1");
            }
            System.out.println();
        }

    }
}

//package programpractise;

import java.util.Scanner;

public class MA{
	static int a[][]=new int [3][3],b[][]=new int [3][3];
	public static void main(String []args){
		Scanner scan=new Scanner(System.in);
		int i,j;
		for(i=0;i<3;i++)
			for(j=0;j<3;j++)
				{
				b[i][j]=scan.nextInt();
				a[i][j]=1;
				}

		for(i=0;i<3;i++)
			for(j=0;j<3;j++)
				toggle(b[i][j],i,j);

		for(i=0;i<3;i++){
			for(j=0;j<3;j++)
				System.out.print(a[i][j]);
		System.out.println();
		}
	}

	public static void toggle(int n,int i,int j){
		while(n-->0){
			for(int g=-1;g<2;g++){
				if(i+g>=0&&i+g<3)
					bool(i+g,j);
				if(g!=0&&j+g>=0&&j+g<3)
					bool(i,j+g);
			}
		}
	}

	public static void bool(int i,int j){
		if(a[i][j]==1)
			a[i][j]=0;
		else
			a[i][j]=1;
	}
}

import java.util.Scanner;

public class LightsOut {

  public static void main(String[] args) {
    Scanner xScanner = new Scanner(System.in);

    //-- Initializiere die Matrix
    int[][] xLightsMatrix = new int[3][3];
    for(int i  = 0 ; i < 3; i++)
      for(int j = 0; j < 3; j++)
        xLightsMatrix[i][j] = 1;

    for(int i  = 0 ; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        int iNumClicks = xScanner.nextInt();
        //-- Falls ungerade, tausche die Werte, sonst mache nichts
        if(iNumClicks % 2 == 1)
          clickPosition(xLightsMatrix, i, j);
      }
    }

    for(int i  = 0 ; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        System.out.print(xLightsMatrix[i][j]);
      }
      System.out.println();
    }
  }

  private static void clickPosition(int[][] matrix, int i, int j) {
    //-- center
    matrix[i][j] = 1 - matrix[i][j];
    //-- top
    if(i-1 >= 0)
      matrix[i-1][j] = 1 - matrix[i-1][j];
    //-- bottom
    if(i+1 < matrix.length)
      matrix[i+1][j] = 1 - matrix[i+1][j];
    //-- left
    if(j-1 >= 0)
      matrix[i][j-1] = 1 - matrix[i][j-1];
    //-- right
    if(j+1 < matrix[i].length)
      matrix[i][j+1] = 1 - matrix[i][j+1];
  }
}

/*
 Author: Togrul Gasimov
 Mail: ttogrul30@gmail.com
 */

import java.util.Collection;
import java.util.Comparator;
import java.util.Locale;
import java.util.Scanner;
import java.util.Vector;
import java.util.Arrays;
import java.math.BigInteger;
import java.math.BigDecimal;
import java.util.List;
import java.util.Stack;

public class Main {

// Function begin

//Function end
static Scanner scan = new Scanner(System.in);
//variables begin
//static double PI=3.1415926535897932384626433832795,E=1e-9;

static int[][] a = new int[5][5];
//variables end

static void read(){

  for(int i=1;i<=3;i++){
	  for(int j=1;j<=3;j++){
		  a[i][j]=scan.nextInt();
	  }
  }
}
static void solve(){

	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			System.out.print( (a[i][j]+a[i+1][j]+a[i-1][j] + a[i][j+1] + a[i][j-1]+1)%2  );
		}
		System.out.println();
	}

}

public static void main(String[] args) {
  read();
  solve();
}
}

import java.util.Scanner;

public class LightsOut {
    static int[] dx = { 1, -1, 0, 0 };
    static int dy[] = { 0, 0, 1, -1 };

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] a = new int[3][3];
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        boolean v[][] = new boolean[3][3];
        for (int i = 0; i < v.length; i++)
            for (int j = 0; j < v.length; j++)
                v[i][j] = true;

        for (int i = 0; i < v.length; i++) {
            for (int j = 0; j < v.length; j++) {
                if (a[i][j] % 2 == 1) {

                    if (v[i][j])
                        v[i][j] = false;
                    else
                        v[i][j] = true;
                    for (int k = 0; k < 4; k++) {
                        int xx = i + dx[k];
                        int yy = j + dy[k];

                        if (xx >= 0 && yy >= 0 && xx < 3 && yy < 3) {
                            if (v[xx][yy])
                                v[xx][yy] = false;
                            else
                                v[xx][yy] = true;
                        }
                    }

                }

            }
        }
        for (int i = 0; i < v.length; i++) {
            for (int j = 0; j < v.length; j++) {
                if (v[i][j])
                    System.out.print(1);
                else
                    System.out.print(0);
            }
            System.out.println();
        }

    }
}

import java.io.*;
import java.util.*;

public class B {

	public static void main(String[] args) throws IOException{
		FastScanner fs = new FastScanner();
		int[][] a = new int[3][3];
		for(int i=0 ; i<3 ; i++) {
			for(int j=0 ; j<3 ; j++) {
				a[i][j] = fs.nextInt();
			}
		}
		int[][] ans = new int[3][3];
		for(int i=0 ; i<3 ; i++) {
			for(int j=0 ; j<3 ; j++) {
				ans[i][j] += a[i][j];
				if(i==0 && j==0) ans[i][j] += a[0][1]+a[1][0];
				else if(i==0 && j==1) ans[i][j] += a[0][0]+a[0][2]+a[1][1];
				else if(i==0 && j==2) ans[i][j] += a[0][1]+a[1][2];
				else if(i==1 && j==0) ans[i][j] += a[0][0]+a[2][0]+a[1][1];
				else if(i==1 && j==1) ans[i][j] += a[0][1]+a[1][2]+a[2][1]+a[1][0];
				else if(i==1 && j==2) ans[i][j] += a[2][2]+a[0][2]+a[1][1];
				else if(i==2 && j==0) ans[i][j] += a[2][1]+a[1][0];
				else if(i==2 && j==1) ans[i][j] += a[2][2]+a[2][0]+a[1][1];
				else if(i==2 && j==2) ans[i][j] += a[1][2]+a[2][1];

				ans[i][j] = (ans[i][j]%2+1)%2;
			}
		}
		for(int i=0 ; i<3 ; i++) {
			for(int j=0 ; j<3 ; j++) {
				System.out.print(ans[i][j]);
			}
			System.out.println();
		}
	}

	static int give(String s, String t) {
		for(int i=0 ; i<Math.min(s.length(), t.length()) ; i++) {
			if(s.charAt(i)!=t.charAt(i)) {
				return i;
			}
		}
		return -1;
	}

	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		String[] readStringArray(int n) {
			String[] a=new String[n];
			for (int i=0; i<n; i++) a[i]=next();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

import java.util.*;
public class LightsOut
{
    static final int INF = Integer.MAX_VALUE;
    static final int NINF = Integer.MIN_VALUE;
    public static void exit()
    {
        System.exit(0);
    }
    public static void main(String[]args)
    {
        Scanner sc = new Scanner(System.in);
        int [][] orig = new int[3][3];
        int [][] input = new int[3][3];
        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                orig[i][j] = 1;
                input[i][j] = sc.nextInt();
            }
        }

        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                if((input[i][j] & 1) == 1)
                {
                    toggle(orig, i, j);
                    if(i+1 < 3)
                        toggle(orig, i+1, j);
                    if(j+1 < 3)
                        toggle(orig, i, j+1);
                    if(i-1 >= 0)
                        toggle(orig, i-1, j);
                    if(j-1 >= 0)
                        toggle(orig, i, j-1);
                }
            }
        }

        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
                System.out.print(orig[i][j]);
            System.out.println();
        }
    }

    public static void toggle(int [][] arr, int i, int j)
    {
        if(arr[i][j] == 0)
            arr[i][j] = 1;
        else
            arr[i][j] = 0;
    }
}

import java.util.Scanner;

public class Codeforce {

    public static void main(String[] args) {

        Scanner cin=new Scanner(System.in);
        int a[][];
        a=new int[5][5];
        for(int i=1;i<4;i++)
            for(int j=1;j<4;j++)
            {
                a[i][j]=cin.nextInt();
            }

        for(int i=1;i<4;i++)
        {
            for(int j=1;j<4;j++)
            {
                System.out.print((a[i][j]+a[i+1][j]+a[i][j+1]+a[i-1][j]+a[i][j-1]+1)%2);
            }
            System.out.println();
        }

}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        // write your code her
        // Main m = new Main();

        //////// Code Begins //////////////////////////
        Scanner sc = new Scanner(System.in);
        boolean [][] res = new boolean[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                int tmp = sc.nextInt();
                if(tmp%2 == 0)
                    continue;
                res[i][j] = !res[i][j];
                if(i != 0){
                    res[i-1][j] = !res[i-1][j];
                }
                if(i != 2){
                    res[i+1][j] = !res[i+1][j];
                }
                if(j != 0){
                    res[i][j-1] = !res[i][j-1];
                }
                if(j != 2){
                    res[i][j+1] = !res[i][j+1];
                }
            }
        }
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(!res[i][j])
                    System.out.print("1");
                else
                    System.out.print("0");
            }
            System.out.println();
        }
        //////// Code Ends ///////////////////////////////
    }
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class R168_A implements Runnable{

	private void solve() throws IOException {
		int[][] bulbs = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				bulbs[i][j] = 1;
			}
		}
//		int[][] presses = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				int val = scanner.nextInt() % 2;
				if (val == 1) {
					bulbs[i][j] = 1 - bulbs[i][j];
					if (i-1>=0)	bulbs[i-1][j] = 1 - bulbs[i-1][j];
					if (i+1<3)	bulbs[i+1][j] = 1 - bulbs[i+1][j];
					if (j-1>=0)	bulbs[i][j-1] = 1 - bulbs[i][j-1];
					if (j+1<3)	bulbs[i][j+1] = 1 - bulbs[i][j+1];
				}
			}
		}

		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				out.print(bulbs[i][j]);
			}
			out.println();
		}

	}

	/////////////////////////////////////////////////
	final int BUF_SIZE = 1024 * 1024 * 8;//important to read long-string tokens properly
	final int INPUT_BUFFER_SIZE = 1024 * 1024 * 8 ;
	final int BUF_SIZE_INPUT = 1024;

	final int BUF_SIZE_OUT = 1024;

	boolean inputFromFile = false;
	String filenamePrefix = "A-small-attempt0";
	String inSuffix = "in.txt";
	String outSuffix = "out.txt";

	//InputStream bis;
	//OutputStream bos;
	PrintStream out;
	ByteScanner scanner;
	ByteWriter writer;

//	@Override
	public void run() {
		try{
			InputStream bis = null;
			OutputStream bos = null;
			//PrintStream out = null;
			if (inputFromFile){
				File baseFile = new File(getClass().getResource("/").getFile());
				bis = new BufferedInputStream(
						new FileInputStream(new File(
								baseFile, filenamePrefix+inSuffix)),
								INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(
						new FileOutputStream(
								new File(baseFile, filenamePrefix+outSuffix)));
				out = new PrintStream(bos);
			}else{
				bis = new BufferedInputStream(System.in, INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(System.out);
				out = new PrintStream(bos);
			}
			scanner = new ByteScanner(bis, BUF_SIZE_INPUT, BUF_SIZE);
			writer = new ByteWriter(bos, BUF_SIZE_OUT);

			solve();
			out.flush();
		}catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public interface Constants {
		final static byte ZERO = '0';//48 or 0x30
		final static byte NINE = '9';
		final static byte SPACEBAR = ' '; //32 or 0x20
		final static byte MINUS = '-'; //45 or 0x2d

		final static char FLOAT_POINT = '.';
	}

	public static class EofException extends IOException{
	}

	public static class ByteWriter implements Constants {

		int bufSize = 1024;
		byte[] byteBuf = new byte[bufSize];
		OutputStream os;

		public ByteWriter(OutputStream os, int bufSize){
			this.os = os;
			this.bufSize = bufSize;
		}

		public void writeInt(int num) throws IOException{
	         int byteWriteOffset = byteBuf.length;
	         if (num==0){
	        	 byteBuf[--byteWriteOffset] = ZERO;
	         }else{
	        	 int numAbs = Math.abs(num);
	        	 while (numAbs>0){
	        		 byteBuf[--byteWriteOffset] = (byte)((numAbs % 10) + ZERO);
	        		 numAbs /= 10;
	        	 }
	        	 if (num<0)
	        		 byteBuf[--byteWriteOffset] = MINUS;
	         }
	         os.write(byteBuf, byteWriteOffset, byteBuf.length - byteWriteOffset);
		}

		/**
		 * Please ensure ar.length <= byteBuf.length!
		 *
		 * @param ar
		 * @throws IOException
		 */
		public void writeByteAr(byte[] ar) throws IOException{
			for (int i = 0; i < ar.length; i++) {
				byteBuf[i] = ar[i];
			}
			os.write(byteBuf,0,ar.length);
		}

		public void writeSpaceBar() throws IOException{
			byteBuf[0] = SPACEBAR;
			os.write(byteBuf,0,1);
		}

	}

	public static class ByteScanner implements Constants{

		InputStream is;

		public ByteScanner(InputStream is, int bufSizeInput, int bufSize){
			this.is = is;
			this.bufSizeInput = bufSizeInput;
			this.bufSize = bufSize;

			byteBufInput = new byte[this.bufSizeInput];
			byteBuf = new byte[this.bufSize];
		}

		public ByteScanner(byte[] data){
			byteBufInput = data;
			bufSizeInput = data.length;
			bufSize = data.length;
			byteBuf = new byte[bufSize];
			byteRead = data.length;
			bytePos = 0;
		}

		private int bufSizeInput;
		private int bufSize;

		byte[] byteBufInput;
		byte by=-1;
		int byteRead=-1;
		int bytePos=-1;

		byte[] byteBuf;
		int totalBytes;

		boolean eofMet = false;

		private byte nextByte() throws IOException{

			if (bytePos<0 || bytePos>=byteRead){
				byteRead = is==null? -1: is.read(byteBufInput);
				bytePos=0;
				if (byteRead<0){
					byteBufInput[bytePos]=-1;//!!!
					if (eofMet)
						throw new EofException();
					eofMet = true;
				}
			}
			return byteBufInput[bytePos++];
		}

		/**
		 * Returns next meaningful character as a byte.

		 *
		 * @return
		 * @throws IOException
		 */
		public byte nextChar() throws IOException{
			while ((by=nextByte())<=0x20);
			return by;
		}

		/**
		 * Returns next meaningful character OR space as a byte.

		 *
		 * @return
		 * @throws IOException
		 */
		public byte nextCharOrSpacebar() throws IOException{
			while ((by=nextByte())<0x20);
			return by;
		}

	    /**
	     * Reads line.
	     *
	     * @return
	     * @throws IOException
	     */
	    public String nextLine() throws IOException {
            readToken((byte)0x20);
            return new String(byteBuf,0,totalBytes);
	    }

	    public byte[] nextLineAsArray() throws IOException {
            readToken((byte)0x20);
            byte[] out = new byte[totalBytes];
            System.arraycopy(byteBuf, 0, out, 0, totalBytes);
            return out;
	    }

	    /**
	     * Reads token. Spacebar is separator char.
	     *
	     * @return
	     * @throws IOException
	     */
	    public String nextToken() throws IOException {
            readToken((byte)0x21);
            return new String(byteBuf,0,totalBytes);
	    }

	    /**
	     * Spacebar is included as separator char
	     *
	     * @throws IOException
	     */
	    private void readToken() throws IOException {
            readToken((byte)0x21);
	    }

	    private void readToken(byte acceptFrom) throws IOException {
            totalBytes = 0;
            while ((by=nextByte())<acceptFrom);
            byteBuf[totalBytes++] = by;
            while ((by=nextByte())>=acceptFrom){
                byteBuf[totalBytes++] = by;
            }
	    }

	    public int nextInt() throws IOException{
			readToken();
			int num=0, i=0;
			boolean sign=false;
			if (byteBuf[i]==MINUS){
				sign = true;
				i++;
			}
			for (; i<totalBytes; i++){
				num*=10;
				num+=byteBuf[i]-ZERO;
			}
			return sign?-num:num;
		}

		public long nextLong() throws IOException{
			readToken();
			long num=0;
			int i=0;
			boolean sign=false;
			if (byteBuf[i]==MINUS){
				sign = true;
				i++;
			}
			for (; i<totalBytes; i++){
				num*=10;
				num+=byteBuf[i]-ZERO;
			}
			return sign?-num:num;
		}

		/*
		//TODO test Unix/Windows formats
		public void toNextLine() throws IOException{
			while ((ch=nextChar())!='\n');
		}
		*/

		public double nextDouble() throws IOException{
			readToken();
			char[] token = new char[totalBytes];
			for (int i = 0; i < totalBytes; i++) {
				token[i] = (char)byteBuf[i];
			}
			return Double.parseDouble(new String(token));
		}

		public int[] loadIntArray(int size) throws IOException{
			int[] a = new int[size];
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public long[] loadLongArray(int size) throws IOException{
			long[] a = new long[size];
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
			return a;
		}

	}

	public static abstract class Timing{
		private static int counter = 0;
		protected String name = "Timing"+(++counter);
		private boolean debug;

		public Timing(boolean debug) {
			super();
			this.debug = debug;
		}

		public abstract void run();
		public void start(){
			long time1 = System.currentTimeMillis();
			run();
			long time2 = System.currentTimeMillis();
			if (debug)
				System.out.println(name+" time = "+(time2-time1)/1000.0+" ms.");
		}

	}

	public static class Alg{
		public static interface BooleanChecker{
			public boolean check(long arg);
		}

		public static class BinarySearch{

			/**
			 * This check returns boolean value, result of function.
			 * It should be monotonic.
			 *
			 * @return
			 */
			public BooleanChecker bc;

			/**
			 * Returns following element:
 0 0 [1] 1 1

			 */
			public long search(long left, long right){
				while (left<=right){
					long mid = (left+right)/2;
					if (bc.check(mid)){
						right = mid-1;
					}else{
						left = mid+1;
					}
				}
				return left;
			}

			/**
			 * Optional.

			 * Returns following element:
 1 1 [1] 0 0

			 */
			public long searchInverted(long left, long right){
				while (left<=right){
					long mid = (left+right)/2;
					if (!bc.check(mid)){
						right = mid-1;
					}else{
						left = mid+1;
					}
				}
				return left - 1;
			}
		}
	}

	public static class Modulo{
		long mod = (long)1e9+7;

		public Modulo(long mod) {
			super();
			this.mod = mod;
		}

		public long inv(long a) {
			long res =  pow(a, mod-2);
			return res;
		}

		public long pow(long a, long x) {
			if (x==0)
				return 1;
			long part = 1;
			if ((x&1)!=0)
				part = a;
			return (part * pow((a*a)%mod, x>>1)) % mod;
		}

	}

	public static void main(String[] args) {
		new R168_A().run();
	}

}

import java.util.Scanner;
public class ahmed
{
    public static void main(String args[])
    {
        Scanner scn = new Scanner(System.in);
        int arr[][] = new int[3][3];
        int number[][] = new int[3][3];
        int i,j,k,l;
        for(i = 0;i < 3; ++i)
        {
            for(j = 0;j < 3; ++j)
            {
               arr[i][j]  = 1;
            }
        }
        for(i = 0;i < 3; ++i)
        {
            for(j = 0;j < 3; ++j)
            {
                number[i][j] = scn.nextInt();
            }
        }
        int sum = 0;
        for(i = 0;i < 3; ++i)
        {
            for(j = 0;j < 3; ++j)
            {
                sum = 0;
                sum = sum + number[i][j];
                for(k = 0;k < 3; ++k)
                {
                    for(l = 0;l < 3; ++l)
                    {
                        if((Math.abs(i - k) == 0 && Math.abs(j - l) == 1) || (Math.abs(i - k) == 1 && Math.abs(j - l) == 0))
                        {
                            sum = sum + number[k][l];
                        }
                    }
                }
                if(sum % 2 == 1)
                {
                    arr[i][j] = 0;
                }
            }
        }
        for(i = 0;i < 3; ++i)
        {
            for(j = 0;j < 3; ++j)
            {
                System.out.print(arr[i][j]);
            }
            System.out.println();
        }
    }
}

import java.io.BufferedReader;
import java.io.*;
import java.util.LinkedList;
import java.util.StringTokenizer;

/**
 * Author: Luis Manuel Díaz Barón
 * Problem:
 * Online Judge:
 * Idea:
 *
 */

public class Main {

    static MyScanner sc;
    static MyWriter mw;
    static String filePath="d:\\lmo.in";
    public static void main(String[] args) throws IOException {
        sc = new MyScanner(System.in);
        mw = new MyWriter(System.out);
        //sc = new MyScanner(new FileReader(filePath));

        while(sc.canRead())
            SolveSingleProblem();

        mw.close();
    }

    public static void SolveSingleProblem() throws IOException{
        // Sove single problem
        int [][] mt = new int[3][3];

        for(int k=0;k<3;k++){
            for(int l=0;l<3;l++){
                mt[k][l]=1;
            }

        }

        for (  int c=0;c<3;c++){

            for(int i=0;i<3;i++){
                int d =sc.nextInt();
                //mw.println(d+":");
                 if(d%2==1)
                    press(mt,c,i);

                //printMTT(mt);
                //mw.println("-------------");
            }
        }

        printMTT(mt);

    }
    static  boolean Can(int i,int j){
        return i>=0 && i<3 && j>=0 && j<3;
    }

    static void press(int [][] mt,int i,int j){
        //int []xs = {0,0,1,-1,1,1,-1,-1};
        //int []ys = {1,-1,0,0,1,-1,1,-1};

        int []xs = {0,0,1,-1};
        int []ys = {1,-1,0,0};
        boolean [][] mark = new boolean[3][3];

        if(mt[i][j]==0 )
            mt[i][j]=1;
        else mt[i][j]=0;

        for(int k=0;k<xs.length;k++){
            if(Can(i+xs[k],j+ys[k])){
                if(mt[i+xs[k]][j+ys[k]]==0 )
                    mt[i+xs[k]][j+ys[k]]=1;
                else mt[i+xs[k]][j+ys[k]]=0;
            }

        }

    }

    static void printMTT(int [][] mt)    {
        for(int k=0;k<3;k++){
            for(int l=0;l<3;l++){
                mw.print(mt[k][l]);
            }
            mw.println("");
        }
    }

}

class Pair{
    public int x,y;
    public Pair(int x,int y){
        this.x = x;
        this.y = y;
    }

}

class FenwickTree{
    int [] tree;
    int mod = 10000;

    public FenwickTree(int n){
        this.tree = new int[n+1];
    }

    public void update(int idx,int v){
        for (int i=idx; i< tree.length ;i+=lowBit(i)){
            tree[i]= (tree[i]+v)%mod;
        }
    }

    public int retrieve(int idx){
        int sum=0;
        for (int i=idx;i>0;i-=lowBit(i)){
            sum= (tree[i]+sum)%mod;
        }
        return sum;
    }

    public int intervalSum(int idx1,int idx2){
        return (mod + retrieve(idx2)- retrieve(idx1-1))%mod;
    }

    public int lowBit(int i){
        return i&-i;
    }
}

class MyScanner{
    BufferedReader br;
    StringTokenizer stk;
    public MyScanner(InputStream stream){
        this.br = new BufferedReader(new InputStreamReader(stream),72357);
        this.stk = new StringTokenizer("");
    }

    public MyScanner(FileReader fr){
        this.br = new BufferedReader(fr);
        this.stk = new StringTokenizer("");
    }

    public String next() throws IOException {
        while(!stk.hasMoreElements()){
            String line = br.readLine();
            if(line == null)
                return null;
            stk = new StringTokenizer(line);
        }
        return stk.nextToken();
    }

    public int nextInt()throws IOException{
        return Integer.parseInt(next());
    }

    public long nextLong() throws IOException{
        return Long.parseLong(next());
    }

    public double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }

    public boolean canRead() throws IOException{
        return br.ready();
    }

    public int [] nextIntArray(int n) throws IOException{
        int arr[] = new int[n];
        for(int i=0;i<n;i++)
            arr[i] = nextInt();
        return arr;
    }

    public long [] nextLongArray(int n) throws IOException{
        long arr[] = new long[n];
        for(int i=0;i<n;i++)
            arr[i] = nextInt();
        return arr;
    }
}

class MyWriter{

    PrintWriter pw;
    public MyWriter(OutputStream out){
        this.pw = new PrintWriter(out);
    }

    public void print(Object obj){
        pw.print(obj.toString());
    }

    public void println(Object obj){
        pw.println(obj.toString());
    }

    public void printArray(Object [] arr){
        for(int i=0;i<arr.length;i++){
            if(i==0)
                print(arr[i].toString());
            else print(" "+arr[i].toString());
        }
    }

    public void printMatrix(Object [][]mt){
        for(int i=0;i<mt.length;i++)       {
            for(int j=0;j<mt[i].length;j++){
                if(j==0) {
                    print(mt[i][j].toString());
                }
                else print(' '+mt[i][j].toString());
            }
            println("");
        }
    }

    public void printMatrix(int [][]mt){
        for(int i=0;i<mt.length;i++)       {
            for(int j=0;j<mt.length;j++){
                if(j==0) {
                    print(mt[i][j]);
                }
                else print(' '+mt[i][j]);
            }
            println("");
        }
    }

    public void close() {
        pw.close();
    }

}

import java.io.*;
import java.util.*;

public class Main
{
    static InputReader in;
    static OutputWriter out;

    public static void main(String[] args) throws IOException
    {
        in = new InputReader(System.in);
        out = new OutputWriter(System.out);
        run();
        out.close();
        System.exit(0);
    }

    private static void run() throws IOException
    {
        int[][] state = new int[3][3];
        for (int i = 0; i < 3; i++) Arrays.fill(state[i], 1);

        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
            {
                int p = in.getInt();
                for (int k = 0; k < p; k++)
                    toggle(i, j, state);
            }

        for (int i = 0; i < 3; i++, out.println())
            for (int j = 0; j < 3; j++)
                out.print(state[i][j]);
    }

    private static void toggle(int i, int j, int[][] state)
    {
        state[i][j] ^= 1;

        if (i + 1 < 3) state[i + 1][j] ^= 1;

        //if (i + 1 < 3 && j + 1 < 3) state[i + 1][j + 1] ^= 1;

        if (j + 1 < 3) state[i][j + 1] ^= 1;

        //if (i - 1 >= 0 && j + 1 < 3) state[i - 1][j + 1] ^= 1;

        if (i - 1 >= 0) state[i - 1][j] ^= 1;

        //if (i - 1 >= 0 && j - 1 >= 0) state[i - 1][j - 1] ^= 1;

        if (j - 1 >= 0) state[i][j - 1] ^= 1;

        //if (i + 1 < 3 && j - 1 >= 0) state[i + 1][j - 1] ^= 1;
    }
}

class InputReader
{
    private BufferedReader reader;
    private StringTokenizer st;

    public InputReader(InputStream stream)
    {
        reader = new BufferedReader(new InputStreamReader(stream), 1024);
    }

    public String getString() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
        {
            String line = reader.readLine();
            if (line == null) return null;
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    public String getLine() throws IOException
    {
        return reader.readLine();
    }

    public int getInt() throws IOException
    {
        return Integer.parseInt(getString());
    }

    public long getLong() throws IOException
    {
        return Long.parseLong(getString());
    }

    public double getDouble() throws IOException
    {
        return Double.parseDouble(getString());
    }

    public boolean ready() throws IOException
    {
        return reader.ready();
    }

    public int[][] getIntTable(int rowCount, int columnCount) throws IOException
    {
        int[][] table = new int[rowCount][];
        for (int i = 0; i < rowCount; i++) table[i] = getIntArray(columnCount);
        return table;
    }

    public int[] getIntArray(int len) throws IOException
    {
        int[] table = new int[len];
        for (int i = 0; i < len; i++) table[i] = getInt();
        return table;
    }
}

class OutputWriter
{
    private PrintWriter writer;

    public OutputWriter(OutputStream stream)
    {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));
    }

    public void print(Object... objects)
    {
        for (int i = 0; i < objects.length; i++)
        {
            if (i != 0) writer.print(' ');
            writer.print(objects[i].toString());
        }
    }

    public void print(String s, Object... objects)
    {
        for (int i = 0; i < objects.length; i++)
        {
            if (i != 0) writer.print(s);
            writer.print(objects[i].toString());
        }
    }

    public void println(Object... objects)
    {
        print(objects);
        writer.println();
    }

    public void printf(String format, Object... objects)
    {
        writer.printf(format, objects);
    }

    public void close()
    {
        writer.close();
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main{

    static void checkAdjacentElements(int array[][], int row, int col) {

        for(int i = 0; i < 2; i ++) {
            for(int j = 0; j < 2; j++) {
                if(row > 0)
                    array[row-1][col] = array[row-1][col] == 0 ? 1 : 0;
                if(row < 2)
                    array[row+1][col]= array[row+1][col] == 0 ? 1 : 0;
                if(col > 0)
                    array[row][col-1] =array[row][col-1] == 0 ? 1 : 0 ;
                if(col < 2)
                    array[row][col+1] = array[row][col+1] == 0 ? 1 : 0;

            }
        }
    }

    public static void main(String... s) {

        Scanner sc = new Scanner(System.in);
        int initialState[][] = {{1,1,1}, {1,1,1}, {1,1,1}};

        int array[][] = new int[3][3];
        for(int i = 0;  i<3; i++) {
            String str = sc.nextLine();
            array[i] = Arrays.stream(str.split("\\s+")).mapToInt(Integer::parseInt).toArray();
        }

        for(int i = 0; i < array.length; i++) {
            for(int j = 0; j < array[i].length; j++) {
                if(array[i][j] % 2 == 0) {
                    //
                } else {
                    initialState[i][j] = initialState[i][j] ^ 1;
                    int row = i;
                    int col = j;
                    if(row > 0)
                        initialState[row-1][col] = initialState[row-1][col] ^ 1;
                    if(row < 2)
                        initialState[row+1][col]= initialState[row+1][col] ^ 1;
                    if(col > 0)
                        initialState[row][col-1] =initialState[row][col-1] ^ 1;
                    if(col < 2)
                        initialState[row][col+1] = initialState[row][col+1] ^ 1;
                }
            }

        }

        for(int i = 0; i < initialState.length; i++) {
            for(int j = 0; j < initialState[i].length; j++) {
                System.out.print(initialState[i][j]);
            }
            System.out.println();
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

	private static BufferedReader reader =
		new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args)
	{
		try
		{
			int[][] matrix = new int[5][5];
			int row = 1; int col = 1;
			for(int i = 0; i<3; i++) {
				String[] op = reader.readLine().split(" ");
				col = 1;
				for(String p : op) {
					int opcode = Integer.parseInt(p);
					if((opcode & 1) == 1) {
						matrix[row-1][col] = (matrix[row-1][col] == 1) ? 0 : 1;
						matrix[row+1][col] = (matrix[row+1][col] == 1) ? 0 : 1;
						matrix[row][col-1] = (matrix[row][col-1] == 1) ? 0 : 1;
						matrix[row][col+1] = (matrix[row][col+1] == 1) ? 0 : 1;
						matrix[row][col] = (matrix[row][col] == 1) ? 0 : 1;
					}
					col++;
				}
				row++;
			}
			StringBuffer result = new StringBuffer();
			String line = "";
			for(int i = 1; i<4; i++) {
				for(int j = 1; j<4; j++) {
					line += (matrix[i][j] == 0 ? 1 : 0);
				}
				result.append(line.trim());
				result.append("\n");
				line = "";
			}

			System.out.println(result.toString());
		}
		catch (NumberFormatException e)
		{
			e.printStackTrace();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
}

import java.util.Scanner;

public class LightsOut
{
	public static void main(String[] args)
	{
		final int N = 3;
		Scanner input = new Scanner(System.in);
		int[][] lights = new int[N][N];
		for (int i = 0; i < N; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				lights[i][j] = 1;
			}
		}
		int temp;
		for (int i = 0; i < N; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				temp = input.nextInt();
				if (temp % 2 == 1)
				{
					lights[i][j] = (lights[i][j] + 1) % 2;
					if (i > 0)
					{
						lights[i - 1][j] = (lights[i - 1][j] + 1) % 2;
					}
					if (i < N - 1)
					{
						lights[i + 1][j] = (lights[i + 1][j] + 1) % 2;
					}
					if (j > 0)
					{
						lights[i][j - 1] = (lights[i][j - 1] + 1) % 2;
					}
					if (j < N - 1)
					{
						lights[i][j + 1] = (lights[i][j + 1] + 1) % 2;
					}
				}
			}
		}
		for (int i = 0; i < N; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				System.out.print(lights[i][j]);
			}
			System.out.println();
		}
	}
}

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        int[][] n = new int[5][5];
        for(int i = 1 ; i <= 3 ; i++)
            for(int j = 1 ; j <= 3 ; ++j)
                n[i][j] = inp.nextInt();
        for(int i = 1 ; i <= 3 ; i++){
            for(int j = 1 ; j <= 3 ; ++j)
                System.out.print(( n[i][j] + n[i-1][j] + n[i+1][j] + n[i][j-1] + n[i][j+1] ) % 2 == 0 ? 1 : 0 );
            System.out.println();
        }
    }
}

//package com.company;

import java.util.*;

public class ATwoSevenFive {
    public static void main(String[] aman) {
        Scanner in = new Scanner(System.in);
        int arr[][] = new int[3][3];
        int times[][] = new int[3][3];

        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                times[i][j] = in.nextInt();

        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                arr[i][j] = 1;

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (times[i][j] % 2 == 0) {
                   // arr[i][j] = 1;
                    continue;
                } else {
                    arr[i][j] = (arr[i][j] == 0 ? 1 : 0);
                    if (i > 0)
                        arr[i - 1][j] = (arr[i - 1][j] == 0 ? 1 : 0);
                    if (i < 2)
                        arr[i + 1][j] = (arr[i + 1][j] == 0 ? 1 : 0);
                    if (j > 0)
                        arr[i][j - 1] = (arr[i][j - 1] == 0 ? 1 : 0);
                    if (j < 2)
                        arr[i][j + 1] = (arr[i][j + 1] == 0 ? 1 : 0);
                }
            }
        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++)
                System.out.print(arr[i][j]);
            System.out.println();
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        boolean[][] grid = new boolean[5][5];
        for (int i = 1; i < 4; i++) {
            for (int j = 1; j < 4; j++) {
                int presses = in.nextInt();
                if (presses % 2 != 0) {
                    grid[i][j] = !grid[i][j];
                    grid[i][j - 1] = !grid[i][j - 1];
                    grid[i][j + 1] = !grid[i][j + 1];

                    grid[i + 1][j] = !grid[i + 1][j];
                    //grid[i + 1][j - 1] = !grid[i + 1][j - 1];
                    //grid[i + 1][j + 1] = !grid[i + 1][j + 1];

                    grid[i - 1][j] = !grid[i - 1][j];
                    //grid[i - 1][j - 1] = !grid[i - 1][j - 1];
                    //grid[i - 1][j + 1] = !grid[i - 1][j + 1];
                }
            }
        }

        for (int i = 1; i < 4; i++) {
            for (int j = 1; j < 4; j++) {
                System.out.print((grid[i][j]) ? "0" : "1");
            }
            System.out.println("");
        }
        /*String s = in.next();
        int up = 0, low = 0;
        for (int i = 0; i< s.length(); i++) {
            if ( Character.isUpperCase(s.charAt(i)) )
                up++;
            else
                low++;
        }
        System.out.println((up > low)? s.toUpperCase() : s.toLowerCase());*/
        /*String s = in.next();
        char [] num = s.toCharArray();
        for (char a : num) {
            if (a != '4' && a != '7') {
                System.out.println("NO"); return;
            }
        }
        System.out.println("YES");*/

    }

    public static void print(boolean[][] grid) {
        for (int i = 1; i < 4; i++) {
            for (int j = 1; j < 4; j++) {
                System.out.print((grid[i][j]) ? "0" : "1");
            }
            System.out.println();
        }
    }
}

import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int g[][] = new int[3][];
        g[0] = new int[]{in.nextInt(),in.nextInt(),in.nextInt()};
        g[1] = in.parseInt1D(3);
        g[2] = in.parseInt1D(3);
        boolean ot[][] = new boolean[3][3];
        for(int i = 0;i < 3;i++) {
            for(int j = 0;j < 3;j++) {
                for(int k = 0;k < g[i][j];k++) {
                    int ax[] = {1,0,-1,0};
                    int bx[] = {0,1,0,-1};
                    ot[i][j] = !ot[i][j];
                    for(int l = 0;l < 4;l++) {
                        int x = i + ax[l];
                        int y = j + bx[l];
                        if(x>= 0 && x<3 && y>=0 && y<3){
                            ot[x][y] = !ot[x][y];
                        }
                    }
                }
            }
        }
        for(int i = 0;i < 3;i++) {
            for(int  j = 0;j < 3;j++) {
                out.print(ot[i][j] ?0:1);

            }
            out.println();
        }
    }
}

class InputReader {
    private BufferedReader br;
    private StringTokenizer st;
    public InputReader(InputStream in) {
        br=new BufferedReader(new InputStreamReader(in));
        try {
            st=new StringTokenizer(br.readLine());
        } catch (IOException ignored) {

        }
    }

    public void readLine() {
        try {
            st=new StringTokenizer(br.readLine());
        } catch (IOException e) {
            return;
        }
    }
    public int nextInt(){
        return Integer.parseInt(st.nextToken());
    }

    /**
     * Parse 1D array from current StringTokenizer
     */
    public int[] parseInt1D(int n){
        readLine();
        int r[]=new int[n];
        for(int i=0;i<n;i++){
            r[i]=nextInt();
        }
        return r;
    }

}

// @author Sanzhar
import java.io.*;
import java.util.*;
import java.awt.Point;

public class Template {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (Exception e) {
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    public void run() throws Exception {
        //in = new BufferedReader(new FileReader("input.txt"));
        //out = new PrintWriter(new FileWriter("output.txt"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.flush();
        out.close();
        in.close();
    }

    public void solve() throws Exception {
        int[][] t = new int[5][5];
        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                t[i][j] += 1;
                int x = nextInt();
                if (x % 2 == 1) {
                    t[i][j] += 1;
                    t[i + 1][j] += 1;
                    t[i - 1][j] += 1;
                    t[i][j + 1] += 1;
                    t[i][j - 1] += 1;
                }
            }
        }
        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                out.print(t[i][j] % 2);
            }
            out.println();
        }
    }

    public static void main(String[] args) throws Exception {
        new Template().run();
    }
}

import java.util.Scanner;
public class lightsOut{
	public static void main(String []args){
		Scanner sc=new Scanner(System.in);
		int [][]a=new int[5][5];
		for(int i=1;i<4;i++){
			for(int j=1;j<4;j++){
				a[i][j]=sc.nextInt();
			}
		}
		for(int i=1;i<4;i++){
			for(int j=1;j<4;j++){
				if( (a[i][j]+a[i-1][j]+a[i+1][j]+a[i][j-1]+a[i][j+1])%2==0 )
					System.out.print("1");
				else
					System.out.print("0");
			}
			System.out.println();
		}
	}
}

import java.util.Scanner;

/**
 *
 * @author 11x256
 */
public class realContest {

    public static void main(String[] args) {
        int a[][] = new int[5][5];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                a[i][j] = 1;
            }

        }

        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                int temp = sc.nextInt();
                if (temp % 2 == 0) {
                    continue;
                }
                if (temp == 0) {
                    continue;
                }

                if(a[i][j] == 1)
                    a[i][j]=0;
                else
                    a[i][j]=1;

                if(a[i-1][j] == 1)
                    a[i-1][j]=0;
                else
                    a[i-1][j]=1;

                if(a[i+1][j] == 1)
                    a[i+1][j]=0;
                else
                    a[i+1][j]=1;

                if(a[i][j-1] == 1)
                    a[i][j-1]=0;
                else
                    a[i][j-1]=1;

                if(a[i][j+1] == 1)
                    a[i][j+1]=0;
                else
                    a[i][j+1]=1;

            }
            sc.nextLine();

        }

        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                System.out.print(a[i][j]);
            }
            System.out.println("");

        }

    }
}

//package ladder1;

import java.util.Scanner;

public class LightsOut_275A {
    public static void main(String[] args) {
        Scanner in =new Scanner(System.in);
        int[][] a=new int[5][5];
        for(int i=1;i<=3;i++) {
            for (int j = 1; j <= 3; j++) {
               a[i][j]=in.nextInt();
            }}
        for(int i=1;i<=3;i++){
            for(int j=1;j<=3;++j) {
                if ((a[i][j] + a[i + 1][j] + a[i - 1][j] + a[i][j + 1] + a[i][j - 1]) % 2 == 0)
                    System.out.print("1");
                else System.out.print("0");
            }
            System.out.println();
        }

    }
}

import java.io.*;
import java.math.*;
import java.util.*;

public class LightsOut_168 {

	public static void main(String[] args) throws IOException {
		// ----------------------------------------------------
		start();
		// ----------------------------------------------------
		int[][] a = new int[3][3];
		int s[][] = new int[3][3];

		for (int i = 0; i < a.length; i++) {
			a[i] = nextIntArray(3);
		}
		for (int i = 0; i < s.length; i++) {
			Arrays.fill(s[i], 1);
		}

		int dx[] = { 0, 0, 1, -1 };
		int dy[] = { 1, -1, 0, 0 };

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < s.length; j++) {
				for (int u = 0; u < a[i][j]; u++) {
					s[i][j]*=-1;
					for (int k = 0; k < 4; k++) {
						int x = i + dx[k];
						int y = j + dy[k];
						try {
							s[x][y] *= -1;
						} catch (Exception e) {
						}
					}

				}

			}
		}

		for (int i = 0; i < s.length; i++) {
			for (int j = 0; j < s.length; j++) {
				if (s[i][j] == 1) {
					out.print(1);
				} else {
					out.print(0);
				}
			}
			out.println();
		}

		// ----------------------------------------------------
		end();
		// ----------------------------------------------------
	}

	static BufferedReader br;
	static PrintWriter out;
	static StringTokenizer sc;

	static void start() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new OutputStreamWriter(System.out));
		sc = new StringTokenizer("");
	}

	static void end() throws IOException {
		br.close();
		out.close();
	}

	static String nextString() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null) {
				return null;
			}
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static String nextLine() throws IOException {
		String s = br.readLine();
		if (s == null) {
			return null;
		}
		return s;
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(nextString());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextString());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextString());
	}

	BigInteger nextBigInteger() throws IOException {
		return new BigInteger(nextString());
	}

	static int[] nextIntArray(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	static long[] nextLongArray(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}

	static char[] nextCharArray() throws IOException {
		return nextString().toCharArray();
	}

	static String[] nextStringArray(int n) throws IOException {
		String[] a = new String[n];
		for (int i = 0; i < n; i++)
			a[i] = nextString();
		return a;
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class LightsOut {

    static int[][] Grid;
    static int[][] pressed;
    static final int[] dx = {1, 0, -1, 0,0};
    static final int[] dy = {0, 1, 0, -1,0};

    public static void main(String[] args) {

        Scanner inp = new Scanner(System.in);
        Grid = new int[3][3];
        for (int[] i : Grid) {
            Arrays.fill(i, 1);
        }
        pressed = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                pressed[i][j] = inp.nextInt();
                toggle(i, j, pressed[i][j]);
            }
        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                System.out.print(Grid[i][j]);
            }
            System.out.print("\n");
        }
    }

    static void toggle(int x, int y, int times) {
        for (int i = 0; i < dx.length; i++) {
            int newx = x + dx[i];
            int newy = y + dy[i];
            if (newx >= 0 && newx < Grid.length && newy >= 0 && newy < Grid[0].length) {
                for (int j = 0; j < times; j++) {
                    Grid[newx][newy] = Grid[newx][newy] == 0 ? 1 : 0;
                }

            }
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class LightsOut275A {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int toggle[][] = new int[3][3];
        for (int i = 0; i < 3; i++) {
            String vals[] = reader.readLine().trim().split("\\s+");
            for (int j = 0; j < 3; j++) {
                toggle[i][j] = Integer.parseInt(vals[j].trim()) % 2;
            }
        }
        boolean bulbs[][] = new boolean[3][3];
        Arrays.fill(bulbs[0], true);
        Arrays.fill(bulbs[1], true);
        Arrays.fill(bulbs[2], true);

        /*
         * for (int i = 0; i < 3; i++) { System.out.println(Arrays.toString(bulbs[i]));
         * }
         */

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int tg = toggle[i][j];
                if (tg == 1) {
                    try {
                        bulbs[i][j] = !bulbs[i][j];
                    } catch (Exception e) {
                        // TODO: handle exception
                    }
                    try {
                        bulbs[i - 1][j] = !bulbs[i - 1][j];
                    } catch (Exception e) {
                        // TODO: handle exception
                    }
                    try {
                        bulbs[i + 1][j] = !bulbs[i + 1][j];
                    } catch (Exception e) {
                        // TODO: handle exception
                    }
                    try {
                        bulbs[i][j - 1] = !bulbs[i][j - 1];
                    } catch (Exception e) {
                        // TODO: handle exception
                    }
                    try {
                        bulbs[i][j + 1] = !bulbs[i][j + 1];
                    } catch (Exception e) {
                        // TODO: handle exception
                    }
                }
            }

        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                System.out.print((bulbs[i][j]) ? 1 : 0);
            }
            System.out.println();
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class LightsOut {
    public static void main(String[] args)
    {
    	boolean [][] finalState=new boolean [3][3];
    	Scanner s=new Scanner(System.in);
    	for(int i=0;i<3;i++) {
    		Arrays.fill(finalState[i], true);
    	}

        int temp;
        for(int i=0;i<3;i++)
        {
        	for(int j=0;j<3;j++) {
        		temp=s.nextInt();
        		if(temp%2!=0) {
        			finalState[i][j]=!finalState[i][j];
        			if(i+1<3) {
        				finalState[i+1][j]=!finalState[i+1][j];
        			}
        			if(j+1<3) {
        				finalState[i][j+1]=!finalState[i][j+1];

        			}
        			if(i-1>=0)
        			{
        				finalState[i-1][j]=!finalState[i-1][j];

        			}
        			if(j-1>=0)
        			{

        				finalState[i][j-1]=!finalState[i][j-1];
        			}
        		}
        	}
        }
        for(int i=0;i<3;i++)
        {
        	for(int j=0;j<3;j++)
        	{
        		if(finalState[i][j]==true)
        			System.out.print(1);
        		else System.out.print(0);

        	}
        	System.out.println();
        }
    }
}

import java.util.*;

import java.lang.*;
import java.io.*;
public class MAIN {

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	 static long gcd(long a, long b)
	    {
	        if (b == 0)
	            return a;
	        return gcd(b , a%b);
	    }

	    // Function to find gcd of array of
	    // numbers
	    static long findGCD(long arr[], int l,int r)
	    {
	        long result = arr[r];
	        for (int i = l; i <r; i++)
	            result = gcd(arr[i], result);

	        return result;
	    }

	public static void main(String[] args){
		// TODO Auto-generated method
		OutputStream outputStream = System.out;
        FastReader scn = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);

        //int n= scn.nextInt();

        boolean[][] mat = new boolean[3][3];

        for(int i=0;i<3;i++)
        {
        	 Arrays.fill(mat[i], true);

        }
        int ma[][] = new int[3][3];
        for(int i=0;i<3;i++)
        {

        	for(int j=0;j<3;j++)
        	{
        		ma[i][j]=scn.nextInt()%2;
        	}
        }

        /*for(int i=0;i<2;i++)
        {
        	for(int j =0;j<2;j++)
        	{
        		if(ma[i][j]==1)
        		{
        			mat[i][j]=!mat[i][j];
        			mat[i][j+1]=!mat[i][j+1];
        			mat[i+1][j]=!mat[i+1][j];

        		}
        	}
        }

        for(int i=1;i<3;i++)
        {
        	for(int j =1;j<3;j++)
        	{
        		if(ma[i][j]==1)
        		{
        			mat[i][j]=!mat[i][j];
        			mat[i][j-1]=!mat[i][j-1];
        			mat[i-1][j]=!mat[i-1][j];

        		}
        	}
        }
        if(ma[1][0]==1)
        	mat[0][1]=!mat[0][1];
        if(ma[0][1]==1)
        	mat[1][1]=!mat[1][1];

        if(ma[2][1]==1)
        	mat[1][1]=!mat[1][1];
        if(ma[1][2]==1)
        	mat[2][2]=!mat[2][2];
        if(ma[1][1]==1)
        mat[1][1]=!mat[1][1];
       if(ma[2][0]==1)
        {
    	   mat[2][0]=!mat[2][0];
    	   mat[1][0]=!mat[1][0];
    	   mat[2][1]=!mat[2][1];

        }
       if(ma[0][2]==1)
       {
   	   mat[0][2]=!mat[0][2];
   	   mat[0][1]=!mat[0][1];
   	   mat[1][2]=!mat[1][2];

       }*/

        if(ma[0][0]==1)
        {
        	mat[0][0]=!mat[0][0];
        	mat[0][1]=!mat[0][1];
        	mat[1][0]=!mat[1][0];
        }

        if(ma[0][1]==1)
        {
        	mat[0][0]=!mat[0][0];
        	mat[0][1]=!mat[0][1];
        	mat[1][1]=!mat[1][1];
        	mat[0][2]=!mat[0][2];
        }

        if(ma[0][2]==1)
        {
        	mat[0][2]=!mat[0][2];
        	mat[0][1]=!mat[0][1];
        	mat[1][2]=!mat[1][2];
        }

        ///////////////////////////////////////

        if(ma[1][0]==1)
        {
        	mat[0][0]=!mat[0][0];
        	mat[2][0]=!mat[2][0];
        	mat[1][0]=!mat[1][0];
        	mat[1][1]=!mat[1][1];
        }

        if(ma[1][1]==1)
        {
        	mat[1][0]=!mat[1][0];
        	mat[0][1]=!mat[0][1];
        	mat[1][1]=!mat[1][1];
        	mat[1][2]=!mat[1][2];
        	mat[2][1]=!mat[2][1];
        }

        if(ma[1][2]==1)
        {
        	mat[0][2]=!mat[0][2];
        	mat[1][1]=!mat[1][1];
        	mat[1][2]=!mat[1][2];

        	mat[2][2]=!mat[2][2];
        }
       //////////////////////////////

        if(ma[2][0]==1)
        {
        	mat[2][0]=!mat[2][0];
        	mat[2][1]=!mat[2][1];
        	mat[1][0]=!mat[1][0];
        }

        if(ma[2][1]==1)
        {
        	mat[2][2]=!mat[2][2];
        	mat[2][1]=!mat[2][1];
        	mat[1][1]=!mat[1][1];
        	mat[2][0]=!mat[2][0];
        }

        if(ma[2][2]==1)
        {
        	mat[2][1]=!mat[2][1];
        	mat[1][2]=!mat[1][2];
        	mat[2][2]=!mat[2][2];
        }

       for(int i=0;i<3;i++)
       {
       	for(int j =0;j<3;j++)
       	{

       			out.print(mat[i][j]==true?1:0);

       	}
       	out.println();
       }

       out.close();

	}

	static boolean isDistinct(int year)
	{
		HashSet<Integer> h = new HashSet<>();

		while(year>0)
		{
			h.add(year%10);
			year=year/10;

		}

		if(h.size()==4) return true;

		return false;

	}

	/*static class comp implements Comparator<Pair>
	{

		@Override
		public int compare(Pair arg0, Pair arg1) {
			// TODO Auto-generated method stub
			if(arg0.b<arg1.b) return 1;
			if(arg0.b>arg1.b) return -1;
			if(arg0.b==arg1.b)
				if(arg0.a<arg1.a) return 1;
				else
					return -1;

			return 0;
		}

	}*/
	static class Pair
	{
	    int a;
	    int b;
	}
	static class Compare
	{
		static void compare(Pair ar[])
		{
			Arrays.sort(ar, new Comparator<Pair>(){
				@Override
				public int compare(Pair arg0, Pair arg1) {
					// TODO Auto-generated method stub
					if(arg0.b<arg1.b) return 1;
					if(arg0.b>arg1.b) return -1;
					if(arg0.b==arg1.b)
						if(arg0.a<arg1.a) return -1;
						else
							return 1;

					return 0;
				}
			});
		}
	}
	public static int[] radixSort(int[] f){ return radixSort(f, f.length); }

	public static int[] radixSort(int[] f, int n)
	{
		int[] to = new int[n];
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]&0xffff)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]&0xffff]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]>>>16)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]>>>16]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		return f;
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class LightsOut275A {
	static int[][] matrizIni = new int[3][3];
	public static void main(String[] args) {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader flujoE = new BufferedReader(isr);
        String cadena1 = null, cadenaR="";
        String[] cadena = null;
        for(int i=0;i<3;i++){
        	for(int j=0;j<3;j++){
        		matrizIni[i][j]=1;
        	}
        }
        for(int i=0;i<3;i++){
        	try {
                cadena1 = flujoE.readLine();
                cadena = cadena1.split(" ");
            } catch (NumberFormatException e) {

            } catch (IOException e) {

            }
        	for(int j=0;j<3;j++){
        		if(Integer.parseInt(cadena[j])%2!=0){
        			if((i-1)>=0){
        				intercambiar(i-1,j);
        			}
        			if((j-1)>=0){
        				intercambiar(i,j-1);
        			}
        			if((i+1)<3){
        				intercambiar(i+1,j);
        			}
        			if((j+1)<3){
        				intercambiar(i,j+1);
        			}
        			intercambiar(i,j);
        		}
        	}
        }
        System.out.println(matrizIni[0][0]+""+matrizIni[0][1]+""+matrizIni[0][2]+"\n"+matrizIni[1][0]+""+matrizIni[1][1]+""+matrizIni[1][2]+"\n"+matrizIni[2][0]+""+matrizIni[2][1]+""+matrizIni[2][2]);
	}

	public static void intercambiar(int i, int j){
		if(matrizIni[i][j]==1){
			matrizIni[i][j]=0;
		}else{
			matrizIni[i][j]=1;
		}
	}
}

import java.io.*;
import java.util.*;

public class Main {

	public static void readInput() throws Exception {

 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));

        boolean [][] matrix = {
            {true,true,true},
            {true,true,true},
            {true,true,true}
        };

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                int val = input.nextInt();
                if (val%2 != 0) {
                    flip(matrix, i, j);
                }
            }
        }
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                out.print(matrix[i][j] ? 1 : 0);
            }
            out.println();
        }

    }

    private static void flip(boolean [][] matrix, int i, int j) {

         matrix[i][j] = !matrix[i][j];

         if (j>0) matrix[i][j-1] = !matrix[i][j-1];
         if (j<2) matrix[i][j+1] = !matrix[i][j+1];

         if (i>0) matrix[i-1][j] = !matrix[i-1][j];
         if (i<2) matrix[i+1][j] = !matrix[i+1][j];

    }

    private static void swap(char []array, int i, int j){
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }

	public static void main(String[] args) throws Exception {

		readInput();
        out.close();
		//shouldReturn10();

	}

    private static InputStream inputStream = System.in;
    private static InputReader input = new InputReader(inputStream);
    private static OutputStream outputStream = System.out;
    private static PrintWriter out = new PrintWriter(outputStream);

    static class InputReader {
        private BufferedReader buf;
        private StringTokenizer token;
        public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        }

        private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        }

        public int nextInt(){
            return Integer.parseInt(next());
        }

        public String nextString(){
            return next();
        }

        public long nextLong(){
            return Long.parseLong(next());
        }
    }
}
class Point{
    int x,y;
    public Point(int x, int y){
        this.x = x;
        this.y = y;
    }
    public String toString(){
        return "("+x+","+y+")";
    }

    public int hashCode(){
        String s = x+""+y;
        return s.hashCode();
    }
    @Override
    public boolean equals(Object obj){
        Point p = (Point) obj;
        return this.x == p.x && this.y == p.y;
    }
}

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

//Codeforces
public class MainCodeforces1 {
    private static MyScanner in;
    private static PrintStream out;

    public static void main(String[] args) throws IOException {
        // helpers for input/output
        boolean LOCAL_TEST = false;// change to false before submitting
        out = System.out;
        if (LOCAL_TEST) {
            in = new MyScanner("E:\\zin2.txt");
        }
        else {
            boolean usingFileForIO = false;
            if (usingFileForIO) {
                // using input.txt and output.txt as I/O
                in = new MyScanner("input.txt");
                out = new PrintStream("output.txt");
            }
            else {
                in = new MyScanner();
                out = System.out;
            }
        }

        solve();
    }

    private static void solve() throws IOException
    {
        boolean[][] L = new boolean[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                L[i][j] = true;
            }
        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int p = in.nextInt();
                if (p % 2 == 1) {
                    L[i][j] = !L[i][j];
                    for (int k = 0; k < 3; k++) {
                        if (Math.abs(k - j) == 1)
                            L[i][k] = !L[i][k];
                        if (Math.abs(k - i) == 1)
                            L[k][j] = !L[k][j];
                    }
                }
            }
        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (L[i][j])
                    out.print("1");
                else
                    out.print("0");
            }
            if (i < 2)
                out.println("");
        }
    }

    // =====================================
    static class MyScanner {
        Scanner inp = null;

        public MyScanner() throws IOException
        {
            inp = new Scanner(System.in);
        }

        public MyScanner(String inputFile) throws IOException {
            inp = new Scanner(new FileInputStream(inputFile));
        }

        public int nextInt() throws IOException {
            return inp.nextInt();
        }

        public long nextLong() throws IOException {
            return inp.nextLong();
        }

        public double nextDouble() throws IOException {
            return inp.nextDouble();
        }

        public String nextString() throws IOException {
            return inp.next();
        }

    }

}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;

public class LightsOut {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        OutputStream out = new BufferedOutputStream(System.out);
        boolean[][] res = { { true, true, true }, { true, true, true },
                { true, true, true } };
        int[][] arr = new int[3][3];
        int[] dr = { -1, 0, 1, 0 };
        int[] dc = { 0, 1, 0, -1 };

        for (int i = 0; i < 3; i++) {
            String[] l = br.readLine().split("\\s+");

            for (int j = 0; j < 3; j++)
                arr[i][j] = Integer.parseInt(l[j]);
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int t = arr[i][j];

                while (t-- > 0) {
                    res[i][j] = !res[i][j];

                    for (int k = 0; k < 4; k++) {
                        int cr = i + dr[k];
                        int cc = j + dc[k];

                        if (cr < 0 || cr >= 3 || cc < 0 || cc >= 3)
                            continue;

                        res[cr][cc] = !res[cr][cc];
                    }
                }
            }
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (res[i][j])
                    out.write(("1").getBytes());
                else
                    out.write(("0").getBytes());
            }
            out.write(("\n").getBytes());
        }

        out.flush();
        br.close();
    }

}

	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.Arrays;
	import java.util.StringTokenizer;
	public class Lo {
		public static void main(String[] args) throws IOException {
			BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
			int sum1=0;
			int sum2=0;
			int sum3=0;
			int sum4=0;
			int sum5=0;
			int sum6=0;
			int sum7=0;
			int sum8=0;
			int sum9=0;
			int y=0;
			for(int i=0; i<3; i++) {
				String s=br.readLine();
				StringTokenizer st = new StringTokenizer(s);
				 while (st.hasMoreTokens()) {
					 int x=Integer.valueOf(st.nextToken());
					 if(x%2!=0)
					 {
						 if(Arrays.asList(0,1,3).contains(y)) {sum1+=x;}
						 if(Arrays.asList(1,0,2,4).contains(y)) {sum2+=x;}
							if(Arrays.asList(2,1,5).contains(y)) {sum3+=x;}
							if(Arrays.asList(0,3,4,6).contains(y)) {sum4+=x;}
							if(Arrays.asList(1,3,4,5,7).contains(y)) {sum5+=x;}
							if(Arrays.asList(2,4,5,8).contains(y)) {sum6+=x;}
							if(Arrays.asList(3,6,7).contains(y)) {sum7+=x;}
							if(Arrays.asList(7,6,4,8).contains(y)) {sum8+=x;}
							if(Arrays.asList(8,7,5).contains(y)) {sum9+=x;}
					 }
					 y++;
			     }
			}
			kiir(paros(sum1));
			kiir(paros(sum2));
			kiir(paros(sum3));
			System.out.println();
			kiir(paros(sum4));
			kiir(paros(sum5));
			kiir(paros(sum6));
			System.out.println();
			kiir(paros(sum7));
			kiir(paros(sum8));
			kiir(paros(sum9));
}
		public static boolean paros(int e) {
			return (e%2==0) ? true : false;
		}
		public static void kiir(boolean b) {
			System.out.print(b ?  1 : 0);
		}
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;

public class cf275 {

    static BufferedReader br;
    static Scanner sc;
    static PrintWriter out;

    public static void initA() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            //br = new BufferedReader(new FileReader("input.txt"));
            sc = new Scanner(System.in);
            //out = new PrintWriter("output.txt");
            out = new PrintWriter(System.out);
        } catch (Exception e) {
        }
    }

    public static void initB() {
        try {

            br = new BufferedReader(new FileReader("input.txt"));
            sc = new Scanner(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");

        } catch (Exception e) {
        }
    }

    public static String getString() {
        try {
            return br.readLine();
        } catch (Exception e) {
        }
        return "";
    }

    public static Integer getInt() {
        try {
            return Integer.parseInt(br.readLine());
        } catch (Exception e) {
        }
        return 0;
    }

    public static Integer[] getIntArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Integer temp2[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Integer.parseInt(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static Long[] getLongArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Long temp2[] = new Long[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Long.parseLong(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static String[] getStringArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            String temp2[] = new String[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = (temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }

    public static int getMax(Integer[] ar) {
        int t = ar[0];
        for (int i = 0; i < ar.length; i++) {
            if (ar[i] > t) {
                t = ar[i];
            }
        }
        return t;
    }

    public static void print(Object a) {
        out.println(a);
    }

    public static int nextInt() {
        return sc.nextInt();
    }

    public static double nextDouble() {
        return sc.nextDouble();
    }

    public static void main(String[] ar) {
        initA();
        solve();
        out.flush();
    }

    public static void solve() {
        int m[][] = new int[3][3];
        int we = 3;
        while (we-- > 0) {
            //System.out.println(we);
            Arrays.fill(m[we], 1);
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int n = nextInt() % 2;
                if (n == 1) {
                    for (int k = 0; k < 3; k++) {
                        if(Math.abs(k-j)<2){
                        m[i][k] = (m[i][k] + n) % 2;
                        }
                        if(Math.abs(k-i)<2){
                        m[k][j] = (m[k][j] + n) % 2;
                        }
                    }
                    m[i][j]= (m[i][j]+1)%2;
                }
                //cetak(m);

            }
        }
        cetak(m);

    }

    static void cetak(int[][] m) {
        for (int i = 0; i < 3; i++) {
            for (int ii = 0; ii < 3; ii++) {
                out.print(m[i][ii]);
            }
            print("");
        }
    }
}

import java.util.Scanner;

public class b  {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int[][] s = new int[3][3];
        int[][] t = new int[3][3];

        for(int i=0; i<3; ++i) {
            for(int j=0; j<3; ++j) {
                t[i][j] = 1;
            }
        }

        for(int i=0; i<3; ++i) {
            for(int j=0; j<3; ++j) {
                int value = s[i][j] = sc.nextInt();
                if(value%2==0) continue;

                t[i][j]^=1;

                if(i+1<3) {
                    t[i+1][j]^=1;
                }
                if(i-1>=0) {
                    t[i-1][j]^=1;
                }
                if(j+1<3) {
                    t[i][j+1]^=1;
                }
                if(j-1>=0) {
                    t[i][j-1]^=1;
                }
            }
        }

        for(int i=0; i<3; ++i) {
            for(int j=0; j<3; ++j) {
                System.out.print(t[i][j]);
            }
            System.out.println();
        }
    }
}

import java.util.*;

public class LightsOut {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[][] lights = new int[5][5];
        int temp = 0;

        for (int i = 1; i <= 3; i++)
            for (int j = 1; j <= 3; j++) {
                int[] x = { -1, 0, 0, 0, 1 };
                int[] y = { 0, -1, 0, 1, 0 };
                temp = in.nextInt();
                for (int k = 0; k < 5; ++k)
                    lights[i + x[k]][j + y[k]] += temp;
            }

        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                if (lights[i][j] % 2 == 0)
                    lights[i][j] = 1;
                else
                    lights[i][j] = 0;
                System.out.print(lights[i][j]);
            }
            System.out.println();
        }
        in.close();

    }
}

import java.util.*;

public class A {

    public static void main(String[] args) {
    	Scanner s = new Scanner(System.in);
    	int[][] matrix = new int[3][3];
    	boolean[][] lights = new boolean[3][3];
    	for(int i=0; i<3; i++)
    		for(int j=0; j<3; j++)
    			matrix[i][j] = s.nextInt();
    	for(int i=0; i<3; i++)
    		for(int j=0; j<3; j++)
    			lights[i][j] = true;
    	for(int i=0; i<3; i++)
    		for(int j=0; j<3; j++) {
    			if(matrix[i][j] % 2 == 1) {
    				int[] x = {0,1,0,-1,0};
    				int[] y = {0,0,-1,0,1};
    				for(int k=0; k<5; k++)
    					if(i+x[k] >= 0 && i+x[k] < 3 && j+y[k] >= 0 && j+y[k] < 3)
    						lights[i+x[k]][j+y[k]] = !lights[i+x[k]][j+y[k]];
    			}
    		}
    	for(int i=0; i<3; i++) {
    		for(int j=0; j<3; j++) {
    			if(lights[i][j])
    				System.out.print(1);
    			else
    				System.out.print(0);
    		}
    		System.out.println();
    	}
    }
}

import java.util.Scanner;

public class CF275A_LightsOut {
	public static int cE(int S) {
		if (S % 2 == 0) {
			S = 1;
		} else {
			S = 0;
		}
		return S;
	}
	public static void main(String[] args) {
		// declare and initialize the input
		int[][] input = new int[3][3];
		Scanner sc = new Scanner(System.in);
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				input[i][j] = sc.nextInt();
			}
		}
		// declare and initialize the output, initially on
		int[][] output = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				output[i][j] = 1;
			}
		}
		for (int count = 0; count < 102; count++) {
			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (input[i][j] > 0) {
						output[i][j] = cE(output[i][j]);
						if (i > 0) {
							output[i - 1][j] = cE(output[i - 1][j]);
						}
						if (j > 0) {
							output[i][j - 1] = cE(output[i][j - 1]);
						}
						if (i < 2) {
							output[i + 1][j] = cE(output[i + 1][j]);
						}
						if (j < 2) {
							output[i][j + 1] = cE(output[i][j + 1]);
						}
						input[i][j]--;
					}
				}
			}
		}
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				System.out.print(output[i][j]);
			}
			System.out.println();
		}
	}
}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R168_Div2_A
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R168_Div2_A().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
        int[][] a = new int[3][3];
        int[][] b = new int[3][3];
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                a[i][j] = in.nextInt();
                b[i][j] = 1;
            }
        }

        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
            {
                int it = a[i][j] % 2;
                for (int num = 0; num < it; num++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (Math.abs(k - j) <= 1)
                            b[i][k] = 1 - b[i][k];
                        if (Math.abs(k - i) <= 1)
                            b[k][j] = 1 - b[k][j];
                    }
                    b[i][j] = 1 - b[i][j]; // remove duplicate
                }
            }

         for (int i = 0; i < 3; i++)
        	 out.println(b[i][0] + "" + b[i][1] + "" + b[i][2]);

	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.io.*;
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class Solution {
    private IO io;
    private int ioMode = -1;
    private String problemName = "";
    private final String mjArgument = "master_j";

    public static void main(String programArguments[]) throws IOException{
        if(programArguments != null && programArguments.length > 0)
            new Solution().run(programArguments[0]);
        else
            new Solution().run(null);
    }

    private void run(String programArgument) throws IOException {
        //         _______________________________________________ _________
        //        |   Input Mode     |      Output Mode    | mode | comment |
        //        |------------------|---------------------|----- |---------|
        //        |   input.txt      |      System.out     |  0   |    mj   |
        //        |   System.in      |      System.out     |  1   |  T / CF |
        //        |<problemName>.in  |  <problemName>.out  |  2   |         |
        //        |   input.txt      |      output.txt     |  3   |    C    |
        //        |__________________|_____________________|______|_________|
        long nanoTime = 0;
        if(programArgument != null && programArgument.equals(mjArgument)) // mj
            ioMode = 0;
        else if(System.getProperty("ONLINE_JUDGE") != null) // T / CF
            ioMode = 1;
        else
            ioMode = 2;
        switch(ioMode){
            case -1:
                try{
                    throw new Exception("<ioMode> init failure") ;
                }catch (Exception e){
                    e.printStackTrace();
                }
                return;
            case 0:
                break;
            case 1:
                break;
            case 2:
                if(problemName.length() == 0){
                    try{
                        throw new Exception("<problemName> init failure");
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                    return;
                }
            case 3:
                break;
        }
        io = new IO(ioMode, problemName);
        if(ioMode == 0){
            System.out.println("File output : \n<start>");
            System.out.flush();
            nanoTime = System.nanoTime();
        }
        solve();
        io.flush();
        if(ioMode == 0){
            System.out.println("</start>");
            long t = System.nanoTime() - nanoTime;
            int d3 = 1000000000, d2 = 1000000, d1 = 1000;
            if(t>=d3)
                System.out.println(t/d3 + "." + t%d3 + " seconds");
            else if(t>=d2)
                System.out.println(t/d2 + "." + t%d2 + " millis");
            else if(t>=d1)
                System.out.println(t/d1 + "." + t%d1 + " micros");
            else
                System.out.println(t + " nanos");
            System.out.flush();
        }
    }

    private void solve() throws IOException {//162-191; 179-182
        final int N = 3;
        boolean a[][] = new boolean[N][N];
        for(int i = 0; i<N; i++)
            for(int j = 0; j<N; j++){
                int t = io.nI();
                if(t % 2 == 1){
                    if(i-1>=0)//up
                        a[i-1][j] ^= true;
                    if(i+1<N)//dwn
                        a[i+1][j] ^= true;
                    if(j-1>=0)//lft
                        a[i][j-1] ^= true;
                    if(j+1<N)///rght
                        a[i][j+1] ^= true;
                    a[i][j] ^= true;
                }
            }
        for(int i = 0; i<N; i++){
            for(int j = 0; j<N; j++)
                io.w(!a[i][j] ? 1 : 0);
            io.wln();
        }
    }

    /**
     * Input-output class
     * @author master_j
     * @version 0.2.5
     */
    @SuppressWarnings("unused")
    private class IO{
        private boolean alwaysFlush;
        StreamTokenizer in; PrintWriter out; BufferedReader br; Reader reader; Writer writer;
        public IO(int ioMode, String problemName) throws IOException{
            Locale.setDefault(Locale.US);
            //         _______________________________________________ _________
            //        |   Input Mode     |      Output Mode    | mode | comment |
            //        |------------------|---------------------|----- |---------|
            //        |   input.txt      |      System.out     |  0   |    mj   |
            //        |   System.in      |      System.out     |  1   |  T / CF |
            //        |<problemName>.in  |  <problemName>.out  |  2   |         |
            //        |   input.txt      |      output.txt     |  3   |    C    |
            //        |__________________|_____________________|______|_________|
            switch(ioMode){
                case 0:
                    reader = new FileReader("input.txt");
                    writer = new OutputStreamWriter(System.out);
                    break;
                case 1:
                    reader = new InputStreamReader(System.in);
                    writer = new OutputStreamWriter(System.out);
                    break;
                case 2:
                    reader = new FileReader(problemName + ".in");
                    writer = new FileWriter(problemName + ".out");
                    break;
                case 3:
                    reader = new FileReader("input.txt");
                    writer = new FileWriter("output.txt");
                    break;
            }
            br = new BufferedReader(reader);
            in = new StreamTokenizer(br);
            out = new PrintWriter(writer);
            alwaysFlush = false;
        }
        public void setAlwaysFlush(boolean arg){alwaysFlush = arg;}
        public void wln(){out.println(); if(alwaysFlush)flush();}
        public void wln(int arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(long arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(double arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(String arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(boolean arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(char arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(float arg){out.println(arg); if(alwaysFlush)flush();}
        public void wln(Object arg){out.println(arg); if(alwaysFlush)flush();}
        public void w(int arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(long arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(double arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(String arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(boolean arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(char arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(float arg){out.print(arg); if(alwaysFlush)flush();}
        public void w(Object arg){out.print(arg); if(alwaysFlush)flush();}
        public void wf(String format, Object...args){out.printf(format, args); if(alwaysFlush)flush();}
        public void flush(){out.flush();}
        public int nI() throws IOException {in.nextToken(); return(int)in.nval;}
        public long nL() throws IOException {in.nextToken(); return(long)in.nval;}
        public String nS() throws IOException {in.nextToken(); return in.sval;}
        public double nD() throws IOException {in.nextToken(); return in.nval;}
        public float nF() throws IOException {in.nextToken(); return (float)in.nval;}
        public char nC() throws IOException {return (char)br.read();}
        public void wc(char...arg){for(char c : arg){in.ordinaryChar(c);in.wordChars(c, c);}}
        public void wc(String arg){wc(arg.toCharArray());}
        public void wc(char arg0, char arg1){in.ordinaryChars(arg0, arg1); in.wordChars(arg0, arg1);}
        public boolean eof(){return in.ttype == StreamTokenizer.TT_EOF;}
        public boolean eol(){return in.ttype == StreamTokenizer.TT_EOL;}
    }
}

import java.util.Scanner;

public class LightsOut {
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int[][] arr= new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                int x= sc.nextInt();
                if(x%2 == 0)
                    arr[i][j] = 0;
                else
                    arr[i][j] = 1;
            }
        }
        int[][] ans=getLightsOn(arr);
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                System.out.print(ans[i][j]);
            }
            System.out.println();
        }
    }
    public static int[][] getLightsOn(int[][] arr){
        int[][] lights= new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                lights[i][j]=1;
            }
        }

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(arr[i][j] == 1){
                    if(lights[i][j]==1)
                        lights[i][j]=0;
                    else
                        lights[i][j]=1;

                    if((i+1)<3){
                            if(lights[i+1][j]==1)
                                lights[i+1][j]=0;
                            else
                                lights[i+1][j]=1;

                        }

                    if((i-1)>=0){
                        if(lights[i-1][j]==1)
                            lights[i-1][j]=0;
                        else
                            lights[i-1][j]=1;

                    }

                    if((j-1)>=0){
                        if(lights[i][j-1]==1)
                            lights[i][j-1]=0;
                        else
                            lights[i][j-1]=1;

                    }

                    if((j+1)<3){
                        if(lights[i][j+1]==1)
                            lights[i][j+1]=0;
                        else
                            lights[i][j+1]=1;

                    }
                }
            }
        }
        return lights;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        //int n = Integer.parseInt(scan.readLine());
        boolean[][] grid = new boolean[3][3]; //false = on, true = off
        int[] dx = {0, 0, 0, 1, -1};
        int[] dy = {0, 1, -1, 0, 0};
        for (int i = 0; i < 3; i++) {
            StringTokenizer st = new StringTokenizer(scan.readLine());
            for (int j = 0; j < 3; j++) {
                int tmp = Integer.parseInt(st.nextToken());
                if (tmp % 2 != 0) {
                    for (int k = 0; k < 5; k++) {
                        if (dx[k] + i < 3 && dx[k] + i > -1 && dy[k] + j < 3 && dy[k] + j > -1) {
                            grid[dx[k] + i][dy[k] + j] = !grid[dx[k] + i][dy[k] + j];
                        }
                    }
                }
            }
        }
        for (boolean[] i:grid) {
            for (boolean j:i) {if (j) System.out.print("0"); else System.out.print("1");}
            System.out.println();
        }

        pw.flush();
        pw.close();
    }
}

    import java.awt.Point;
    import java.io.*;
    import java.math.BigInteger;
    import java.util.*;
    import static java.lang.Math.*;

    public class Solution implements Runnable {

            BufferedReader in;
            PrintWriter out;
            StringTokenizer tok = new StringTokenizer("");

            public static void main(String[] args) {
                    new Thread(null, new Solution(), "", 256 * (1L << 20)).start();
            }

            public void run() {
                    try {
                            long t1 = System.currentTimeMillis();
                            if (System.getProperty("ONLINE_JUDGE") != null) {
                                    in = new BufferedReader(new InputStreamReader(System.in));
                                    out = new PrintWriter(System.out);
                            } else {
                                    in = new BufferedReader(new FileReader("input.txt"));
                                    out = new PrintWriter("output.txt");
                            }
                            Locale.setDefault(Locale.US);
                            solve();
                            in.close();
                            out.close();
                            long t2 = System.currentTimeMillis();
                            System.err.println("Time = " + (t2 - t1));
                    } catch (Throwable t) {
                            t.printStackTrace(System.err);
                            System.exit(-1);
                    }
            }

            String readString() throws IOException {
                    while (!tok.hasMoreTokens()) {
                            tok = new StringTokenizer(in.readLine());
                    }
                    return tok.nextToken();
            }

            int readInt() throws IOException {
                    return Integer.parseInt(readString());
            }

            long readLong() throws IOException {
                    return Long.parseLong(readString());
            }

            double readDouble() throws IOException {
                    return Double.parseDouble(readString());
            }

            // solution

            void solve() throws IOException {
                int[][] mas = new int[3][3];
                int[][] answer = new int[3][3];
                for(int i = 0; i<3; i++)
                    for(int j = 0; j<3; j++)
                        mas[i][j] = readInt();

                for(int i = 0; i<3; i++)
                    for(int j = 0; j<3; j++)
                    {
                        answer[i][j] += mas[i][j];
                        if(i-1>=0) answer[i-1][j] += mas[i][j];
                        if(i+1 < 3) answer[i+1][j] += mas[i][j];
                        if(j-1 >= 0) answer[i][j-1] += mas[i][j];
                        if(j+1 < 3) answer[i][j+1] += mas[i][j];
                    }

                for(int i = 0; i<3; i++)
                {
                    for(int j = 0; j<3; j++)
                        if(answer[i][j] % 2 == 0)
                            out.print('1');
                        else
                            out.print('0');
                    out.println("");
                }
            }

    }

import java.io.*;
import java.util.*;

public class A {
    static final int INF = (int) 1e9 + 7;
    static final int MAXN = (int) 1e6 + 1;
    static int[][] a = new int[3][3];
    static int[][] ans = new int[3][3];
    static int[] dx = {-1 , 0, 1, 0, 0}, dy = {0 , -1, 0, 1, 0};

    static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
    static Reader in = new Reader();

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);

        for(int i = 0; i < 3; i++)
            for(int j = 0; j < 3; j++)
                ans[i][j] = 1;

        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) {
                a[i][j] = in.nextInt();

                if(a[i][j] % 2 == 1)
                    for(int k = 0; k <= 4; k++)
                        if(dx[k] + i >= 0 && dx[k] + i < 3 && dy[k] + j >= 0 && dy[k] + j < 3)
                            ans[dx[k] + i][dy[k] + j] = Math.abs(ans[dx[k] + i][dy[k] + j] - 1);

            }
        }

        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++)
                out.write(ans[i][j]+"");

            out.write("\n");
        }

        out.flush();

    }

    static boolean test(int y) {
        Set<Integer> s = new HashSet<>();
        while(y != 0) {
            if(s.contains(y % 10))
                return true;
            s.add(y % 10);
            y /= 10;
        }
        return false;
    }

    static class Pair<U, V> implements Comparable<Pair<U, V>> {
        U first;
        V second;

        public Pair(U first, V second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public boolean equals(Object obj) {
            if(obj == null) return false;
            Pair<U, V> o = (Pair<U, V>) obj;
            return this.first.equals(o.first) && this.second.equals(o.second);
        }

        @Override
        public int compareTo(Pair<U, V> p) {
            int firstC = ((Comparable) first).compareTo((Comparable) p.first);
            if(firstC == 0)
                return ((Comparable) second).compareTo((Comparable) p.second);
            return firstC;
        }
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public String next() throws IOException
        {
            byte[] buf = new byte[64]; // string length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == ' ' || c == '\t' || c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}

import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class forces{
    public static void main(String args[])throws IOException{
		//DataInputStream ins=new DataInputStream(System.in);
		Reader sc=new Reader();
		//int t=sc.nextInt();
		int arr[][]=new int[3][3];
		int show[][]=new int[3][3];
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				arr[i][j]=sc.nextInt();
				show[i][j]=1;
			}
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(arr[i][j]%2!=0){
					if(show[i][j]==0){
						show[i][j]=1;
						if(i+1<3){
							if(show[i+1][j]==1){
								show[i+1][j]=0;
							}
							else{
								show[i+1][j]=1;
							}
						}
						if(i-1>=0){
							if(show[i-1][j]==1){
								show[i-1][j]=0;
							}
							else{
								show[i-1][j]=1;
							}
						}
						if(j+1<3){
							if(show[i][j+1]==1){
								show[i][j+1]=0;
							}
							else{
								show[i][j+1]=1;
							}
						}
						if(j-1>=0){
							if(show[i][j-1]==1){
								show[i][j-1]=0;
							}
							else{
								show[i][j-1]=1;
							}
						}
					}
					else{
						show[i][j]=0;
						if(i+1<3){
							if(show[i+1][j]==1){
								show[i+1][j]=0;
							}
							else{
								show[i+1][j]=1;
							}
						}
						if(i-1>=0){
							if(show[i-1][j]==1){
								show[i-1][j]=0;
							}
							else{
								show[i-1][j]=1;
							}
						}
						if(j+1<3){
							if(show[i][j+1]==1){
								show[i][j+1]=0;
							}
							else{
								show[i][j+1]=1;
							}
						}
						if(j-1>=0){
							if(show[i][j-1]==1){
								show[i][j-1]=0;
							}
							else{
								show[i][j-1]=1;
							}
						}
					}
				}
			}
		}

		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				System.out.print(show[i][j]);
			}
			System.out.println();
		}
	}

	/*
	Code for simuntanious sorting...
		Integer[] idxs = new Integer[drag.length];
		for(int i = 0; i < drag.length; i++) idxs[i] = i;
		Arrays.sort(idxs, (o1,o2) -> Integer.compare(drag[o1], drag[o2]));

	*/

	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
}

/*

*/

import java.util.*;

public class LightsOut {

	public static Scanner scan = new Scanner(System.in);
	public static void main(String[] args) {

		int a[][] = {{1,1,1}, {1,1,1}, {1,1,1}};
		int given[][] = new int[3][3];

		for(int i=0; i<3; i++) {
			for(int j=0; j<3; j++) {
				int s = scan.nextInt();
				given[i][j] = s%2;
				if(given[i][j] == 1) {
					if(a[i][j] == 0) a[i][j] = 1;
					else a[i][j] = 0;
					if(i-1 >= 0) if(a[i-1][j] == 0) a[i-1][j] = 1;
					else a[i-1][j] = 0;
					if(i+1 < 3) if(a[i+1][j] == 0) a[i+1][j] = 1;
					else a[i+1][j] = 0;

					if(j-1 >= 0) if(a[i][j-1] == 0) a[i][j-1] = 1;
					else a[i][j-1] = 0;
					if(j+1 < 3) if(a[i][j+1] == 0) a[i][j+1] = 1;
					else a[i][j+1] = 0;
				}
			}
		}

		for(int i=0; i<3; i++) {
			for(int j=0; j<3; j++) {
				System.out.print(a[i][j]);
			}
			System.out.println();
		}

	}

}

import java.util.Scanner;
public class LightOut {
     static boolean valid(int i,int j)
     {
         if(i>=0 && i<=2 && j>=0 && j<=2)
         {
             return true;
         }
         return false;
     }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a[][]=new int[3][3];
        int b[][]=new int[3][3];

        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                a[i][j]=sc.nextInt();
                b[i][j]=a[i][j];
            }
        }

        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                if(valid(i-1,j))
                {
                    b[i-1][j]+=a[i][j];
                }
                if(valid(i+1,j))
                {
                    b[i+1][j]+=a[i][j];
                }
                if(valid(i,j-1))
                {
                    b[i][j-1]+=a[i][j];
                }
                if(valid(i,j+1))
                {
                    b[i][j+1]+=a[i][j];
                }

            }
        }
        StringBuilder sb=new StringBuilder();
        for(int i=0;i<=2;i++)
        {
            for(int j=0;j<=2;j++)
            {
                if(b[i][j]%2==0)
                {
                    sb.append(1);
                }
                else
                {
                    sb.append(0);
                }
            }
            sb.append("\n");
        }
        System.out.println(sb);
    }
}

import java.util.Scanner;
public class LightOut {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a[][]=new int[3][3];
        int s[][]=new int[3][3];
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                a[i][j]=sc.nextInt();
                s[i][j]=1;
            }
        }
        int d[][]=new int[][]{{0,1},{1,0},{-1,0},{0,-1}};
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                int k=a[i][j];
                if(k%2!=0)

                        s[i][j]=1-s[i][j];
                for(int p[]:d)
                {

                    int x=p[0]+i;
                    int y=p[1]+j;

                    if(x<0 || y<0 || x>=3 || y>=3 )continue;
                    if(k%2!=0)
                        s[x][y]=1-s[x][y];
                }

            }
        }
        StringBuilder sb=new StringBuilder();
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                sb.append(s[i][j]);
            }
            sb.append("\n");
        }
        System.out.println(sb);
    }
}

import java.io.*;
import java.util.*;
import java.util.stream.IntStream;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class LightsOut {
    public static void main(String[] $) throws IOException {
        LightsOut o = new LightsOut();
        o.main();
        out.flush();
        out.close();
    }

    void main() throws IOException {
        int[][] tab = in.rim(3, 3);
        boolean[][] result = new boolean[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                result[i][j] = true;
            }
        }
        if (tab[0][0] % 2 != 0) {
            result[0][0] = !result[0][0];
            result[1][0] = !result[1][0];
            //result[1][1] = !result[1][1];
            result[0][1] = !result[0][1];
        }
        if (tab[1][0] % 2 != 0) {
            result[0][0] = !result[0][0];
            result[1][0] = !result[1][0];
            result[2][0] = !result[2][0];
            //result[0][1] = !result[0][1];
            result[1][1] = !result[1][1];
            //result[2][1] = !result[2][1];
        }
        if (tab[2][0] % 2 != 0) {
            //result[1][1] = !result[1][1];
            result[2][0] = !result[2][0];
            result[2][1] = !result[2][1];
            result[1][0] = !result[1][0];
        }
        if (tab[0][1] % 2 != 0) {
            result[0][0] = !result[0][0];
            //result[1][0] = !result[1][0];
            result[0][1] = !result[0][1];
            result[1][1] = !result[1][1];
            //result[1][2] = !result[1][2];
            result[0][2] = !result[0][2];
        }
        if (tab[1][1] % 2 != 0) {
            result[1][1] = !result[1][1];
            result[0][1] = !result[0][1];
            result[2][1] = !result[2][1];
            result[1][0] = !result[1][0];
            result[1][2] = !result[1][2];
        }
        if (tab[2][1] % 2 != 0) {
            //result[1][0] = !result[1][0];
            result[1][1] = !result[1][1];
            //result[1][2] = !result[1][2];
            result[2][0] = !result[2][0];
            result[2][1] = !result[2][1];
            result[2][2] = !result[2][2];
        }
        if (tab[0][2] % 2 != 0) {
            //result[1][1] = !result[1][1];
            result[0][1] = !result[0][1];
            result[0][2] = !result[0][2];
            result[1][2] = !result[1][2];
        }
        if (tab[1][2] % 2 != 0) {
            //result[0][1] = !result[0][1];
            result[0][2] = !result[0][2];
            result[1][1] = !result[1][1];
            result[1][2] = !result[1][2];
            //result[2][1] = !result[2][1];
            result[2][2] = !result[2][2];
        }
        if (tab[2][2] % 2 != 0) {
            result[2][2] = !result[2][2];
            result[2][1] = !result[2][1];
            result[1][2] = !result[1][2];
            //result[1][1] = !result[1][1];
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (result[i][j]) out.pr(1);
                else out.pr(0);
            }
            out.prln();
        }
    }

    static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));
    static StringTokenizer input;
    static Random __rand = new Random();
    // constants
    static final int IBIG = 1000000007;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;

    //Fast Reader Class
    /*static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }*/

    //Input fxs
    static class in {
        // input
        static void r() throws IOException {
            input = new StringTokenizer(rline());
        }

        static int ri() throws IOException {
            return Integer.parseInt(rline());
        }

        static long rl() throws IOException {
            return Long.parseLong(rline());
        }

        static double rd() throws IOException {
            return Double.parseDouble(rline());
        }

        static int[] ria(int n) throws IOException {
            int[] a = new int[n];
            r();
            for (int i = 0; i < n; ++i) a[i] = ni();
            return a;
        }

        static int[] riam1(int n) throws IOException {
            int[] a = new int[n];
            r();
            for (int i = 0; i < n; ++i) a[i] = ni() - 1;
            return a;
        }

        static long[] rla(int n) throws IOException {
            long[] a = new long[n];
            r();
            for (int i = 0; i < n; ++i) a[i] = nl();
            return a;
        }

        static double[] rda(int n) throws IOException {
            double[] a = new double[n];
            r();
            for (int i = 0; i < n; ++i) a[i] = nd();
            return a;
        }

        static char[] rcha() throws IOException {
            return rline().toCharArray();
        }

        static ArrayList<Integer> riaa(int n) throws IOException {
            ArrayList<Integer> a = new ArrayList<>();
            r();
            for (int i = 0; i < n; i++) a.add(ni());
            return a;
        }

        static String rline() throws IOException {
            return __in.readLine();
        }

        static String n() {
            return input.nextToken();
        }

        static int rni() throws IOException {
            r();
            return ni();
        }

        static int ni() {
            return Integer.parseInt(n());
        }

        static long rnl() throws IOException {
            r();
            return nl();
        }

        static long nl() {
            return Long.parseLong(n());
        }

        static double rnd() throws IOException {
            r();
            return nd();
        }

        static double nd() {
            return Double.parseDouble(n());
        }

        static List<List<Integer>> rg(int n, int m) throws IOException {
            List<List<Integer>> g = GR.g(n);
            for (int i = 0; i < m; ++i) GR.c(g, rni() - 1, ni() - 1);
            return g;
        }

        static void rg(List<List<Integer>> g, int m) throws IOException {
            for (int i = 0; i < m; ++i) GR.c(g, rni() - 1, ni() - 1);
        }

        static List<List<Integer>> rdg(int n, int m) throws IOException {
            List<List<Integer>> g = GR.g(n);
            for (int i = 0; i < m; ++i) GR.cto(g, rni() - 1, ni() - 1);
            return g;
        }

        static void rdg(List<List<Integer>> g, int m) throws IOException {
            for (int i = 0; i < m; ++i) GR.cto(g, rni() - 1, ni() - 1);
        }

        static List<Set<Integer>> rsg(int n, int m) throws IOException {
            List<Set<Integer>> g = GR.sg(n);
            for (int i = 0; i < m; ++i) GR.c(g, rni() - 1, ni() - 1);
            return g;
        }

        static void rsg(List<Set<Integer>> g, int m) throws IOException {
            for (int i = 0; i < m; ++i) GR.c(g, rni() - 1, ni() - 1);
        }

        static List<Set<Integer>> rdsg(int n, int m) throws IOException {
            List<Set<Integer>> g = GR.sg(n);
            for (int i = 0; i < m; ++i) GR.cto(g, rni() - 1, ni() - 1);
            return g;
        }

        static void rdsg(List<Set<Integer>> g, int m) throws IOException {
            for (int i = 0; i < m; ++i) GR.cto(g, rni() - 1, ni() - 1);
        }

        static int[][] rim(int n, int m) throws IOException {
            int[][] a = new int[m][n];
            for (int i = 0; i < n; i++) {
                in.r();
                for (int j = 0; j < m; j++) {
                    a[i][j] = in.ni();
                }
            }
            return a;
        }
    }

    //Output fxs
    static class out {
        // output
        static void pr(int i) {
            __out.print(i);
        }

        static void prln(int i) {
            __out.println(i);
        }

        static void pr(long l) {
            __out.print(l);
        }

        static void prln(long l) {
            __out.println(l);
        }

        static void pr(double d) {
            __out.print(d);
        }

        static void prln(double d) {
            __out.println(d);
        }

        static void pr(char c) {
            __out.print(c);
        }

        static void prln(char c) {
            __out.println(c);
        }

        static void pr(char[] s) {
            __out.print(new String(s));
        }

        static void prln(char[] s) {
            __out.println(new String(s));
        }

        static void pr(String s) {
            __out.print(s);
        }

        static void prln(String s) {
            __out.println(s);
        }

        static void pr(Object o) {
            __out.print(o);
        }

        static void prln(Object o) {
            __out.println(o);
        }

        static void prln() {
            __out.println();
        }

        static void pryes() {
            prln("yes");
        }

        static void pry() {
            prln("Yes");
        }

        static void prY() {
            prln("YES");
        }

        static void prno() {
            prln("no");
        }

        static void prn() {
            prln("No");
        }

        static void prN() {
            prln("NO");
        }

        static void pryesno(boolean b) {
            prln(b ? "yes" : "no");
        }

        ;

        static void pryn(boolean b) {
            prln(b ? "Yes" : "No");
        }

        static void prYN(boolean b) {
            prln(b ? "YES" : "NO");
        }

        static void prln(int... a) {
            for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i) ;
            if (a.length > 0) prln(a[a.length - 1]);
            else prln();
        }

        static void prln(long... a) {
            for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i) ;
            if (a.length > 0) prln(a[a.length - 1]);
            else prln();
        }

        static void prln(double... a) {
            for (int i = 0, len = a.length - 1; i < len; pr(a[i]), pr(' '), ++i) ;
            if (a.length > 0) prln(a[a.length - 1]);
            else prln();
        }

        static <T> void prln(Collection<T> c) {
            int n = c.size() - 1;
            Iterator<T> iter = c.iterator();
            for (int i = 0; i < n; pr(iter.next()), pr(' '), ++i) ;
            if (n >= 0) prln(iter.next());
            else prln();
        }

        static void h() {
            prln("hlfd");
            flush();
        }

        static void flush() {
            __out.flush();
        }

        static void close() {
            __out.close();
        }

        static void prM(boolean[][] a, int n, int m) {
            for (int i = 0; i < m; i++) {
                for (int j = 0; j < n; j++)
                    out.pr(a[i][j] + " ");
                out.prln();
            }
        }
    }

    //Math fxs
    static class mathx {
        // math util
        static int minof(int a, int b, int c) {
            return min(a, min(b, c));
        }

        static int minof(int... x) {
            if (x.length == 1) return x[0];
            if (x.length == 2) return min(x[0], x[1]);
            if (x.length == 3) return min(x[0], min(x[1], x[2]));
            int min = x[0];
            for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i];
            return min;
        }

        static long minof(long a, long b, long c) {
            return min(a, min(b, c));
        }

        static long minof(long... x) {
            if (x.length == 1) return x[0];
            if (x.length == 2) return min(x[0], x[1]);
            if (x.length == 3) return min(x[0], min(x[1], x[2]));
            long min = x[0];
            for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i];
            return min;
        }

        static int maxof(int a, int b, int c) {
            return max(a, max(b, c));
        }

        static int maxof(int... x) {
            if (x.length == 1) return x[0];
            if (x.length == 2) return max(x[0], x[1]);
            if (x.length == 3) return max(x[0], max(x[1], x[2]));
            int max = x[0];
            for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i];
            return max;
        }

        static long maxof(long a, long b, long c) {
            return max(a, max(b, c));
        }

        static long maxof(long... x) {
            if (x.length == 1) return x[0];
            if (x.length == 2) return max(x[0], x[1]);
            if (x.length == 3) return max(x[0], max(x[1], x[2]));
            long max = x[0];
            for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i];
            return max;
        }

        static int powi(int a, int b) {
            if (a == 0) return 0;
            int ans = 1;
            while (b > 0) {
                if ((b & 1) > 0) ans *= a;
                a *= a;
                b >>= 1;
            }
            return ans;
        }

        static long powl(long a, int b) {
            if (a == 0) return 0;
            long ans = 1;
            while (b > 0) {
                if ((b & 1) > 0) ans *= a;
                a *= a;
                b >>= 1;
            }
            return ans;
        }

        static int fli(double d) {
            return (int) d;
        }

        static int cei(double d) {
            return (int) ceil(d);
        }

        static long fll(double d) {
            return (long) d;
        }

        static long cel(double d) {
            return (long) ceil(d);
        }

        static int gcf(int a, int b) {
            return b == 0 ? a : gcf(b, a % b);
        }

        static long gcf(long a, long b) {
            return b == 0 ? a : gcf(b, a % b);
        }

        static int lcm(int a, int b) {
            return a * b / gcf(a, b);
        }

        static long lcm(long a, long b) {
            return a * b / gcf(a, b);
        }

        static int randInt(int min, int max) {
            return __rand.nextInt(max - min + 1) + min;
        }

        static long mix(long x) {
            x += 0x9e3779b97f4a7c15L;
            x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L;
            x = (x ^ (x >> 27)) * 0x94d049bb133111ebL;
            return x ^ (x >> 31);
        }
    }

    //Array fxs
    static class ARR {
        // array util
        static void reverse(int[] a) {
            for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
                int swap = a[i];
                a[i] = a[n - i - 1];
                a[n - i - 1] = swap;
            }
        }

        static void reverse(long[] a) {
            for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
                long swap = a[i];
                a[i] = a[n - i - 1];
                a[n - i - 1] = swap;
            }
        }

        static void reverse(double[] a) {
            for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
                double swap = a[i];
                a[i] = a[n - i - 1];
                a[n - i - 1] = swap;
            }
        }

        static void reverse(char[] a) {
            for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
                char swap = a[i];
                a[i] = a[n - i - 1];
                a[n - i - 1] = swap;
            }
        }

        static void shuffle(int[] a) {
            int n = a.length - 1;
            for (int i = 0; i < n; ++i) {
                int ind = mathx.randInt(i, n);
                int swap = a[i];
                a[i] = a[ind];
                a[ind] = swap;
            }
        }

        static void shuffle(long[] a) {
            int n = a.length - 1;
            for (int i = 0; i < n; ++i) {
                int ind = mathx.randInt(i, n);
                long swap = a[i];
                a[i] = a[ind];
                a[ind] = swap;
            }
        }

        static void shuffle(double[] a) {
            int n = a.length - 1;
            for (int i = 0; i < n; ++i) {
                int ind = mathx.randInt(i, n);
                double swap = a[i];
                a[i] = a[ind];
                a[ind] = swap;
            }
        }

        static void rsort(int[] a) {
            shuffle(a);
            sort(a);
        }

        static void rsort(long[] a) {
            shuffle(a);
            sort(a);
        }

        static void rsort(double[] a) {
            shuffle(a);
            sort(a);
        }

        static int[] copy(int[] a) {
            int[] ans = new int[a.length];
            System.arraycopy(a, 0, ans, 0, a.length);
            return ans;
        }

        static long[] copy(long[] a) {
            long[] ans = new long[a.length];
            System.arraycopy(a, 0, ans, 0, a.length);
            return ans;
        }

        static double[] copy(double[] a) {
            double[] ans = new double[a.length];
            System.arraycopy(a, 0, ans, 0, a.length);
            return ans;
        }

        static char[] copy(char[] a) {
            char[] ans = new char[a.length];
            System.arraycopy(a, 0, ans, 0, a.length);
            return ans;
        }
    }

    //Graph fxs
    static class GR {
        // graph util
        static List<List<Integer>> g(int n) {
            List<List<Integer>> g = new ArrayList<>();
            for (int i = 0; i < n; ++i) g.add(new ArrayList<>());
            return g;
        }

        static List<Set<Integer>> sg(int n) {
            List<Set<Integer>> g = new ArrayList<>();
            for (int i = 0; i < n; ++i) g.add(new HashSet<>());
            return g;
        }

        static void c(List<? extends Collection<Integer>> g, int u, int v) {
            g.get(u).add(v);
            g.get(v).add(u);
        }

        static void cto(List<? extends Collection<Integer>> g, int u, int v) {
            g.get(u).add(v);
        }

        static void dc(List<? extends Collection<Integer>> g, int u, int v) {
            g.get(u).remove(v);
            g.get(v).remove(u);
        }

        static void dcto(List<? extends Collection<Integer>> g, int u, int v) {
            g.get(u).remove(v);
        }
    }

    //Utilsx class
    static class utilX {
        static int[] subsetSum(int[] nums) {
            int M = IntStream.of(nums).sum();
            int[] m = new int[M + 10];
            for (int i = 0; i < M + 10; i++) m[i] = 0;
            m[0] = 1;
            for (int num : nums) {
                for (int j = M; j >= num; j--) {
                    m[j] |= m[j - num];
                }
            }
            return m;
        }

        static int LIS(int[] nums) {
            int[] m = new int[nums.length];
            for (int i = nums.length - 1; i >= 0; i--) {
                m[i] = 1;
                for (int j = i + 1; j < nums.length; j++) {
                    if (nums[j] > nums[i]) {
                        m[i] = max(m[i], m[j] + 1);
                    }
                }
            }
            int ans = 0;
            for (int i = 0; i < nums.length; i++) {
                ans = max(ans, m[i]);
            }
            return ans;
        }
    }
    //Pair Class
    /*class Pair implements Comparable<Pair> {
        double logValue;
        int index;

        Pair(double logValue, int index) {
            this.logValue = logValue;
            this.index = index;
        }

        @Override
        public int compareTo(Pair that) {
            return Double.compare(this.logValue, that.logValue);
        }
    }*/

}

import java.util.*;

public class solution {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int[][] a=new int[3][3];
		int[][] b=new int[3][3];
		for(int i=0;i<3;i++) {
			for(int j=0;j<3;j++) {
				a[i][j]=sc.nextInt();
				b[i][j]=a[i][j];
			}
		}

		for(int i=0;i<3;i++) {
			for(int j=0;j<3;j++) {
				if(j-1>=0) {
					b[i][j-1]+=a[i][j];
				}
				if(i-1>=0) {
					b[i-1][j]+=a[i][j];
				}
				if(j+1<=2) {
					b[i][j+1]+=a[i][j];
				}
				if(i+1<=2) {
					b[i+1][j]+=a[i][j];
				}
			}
		}
		for(int i=0;i<3;i++) {
			for(int j=0;j<3;j++) {
				if(b[i][j]%2==0) {
					System.out.print(1);
				}
				else {
					System.out.print(0);
				}
			}
			System.out.println();
		}
		sc.close();
	}
}

import java.util.*;

public class S {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		int[][] arr = { {1,1,1},
					    {1,1,1},
					    {1,1,1} };

		int[][] given = new int[3][3];

		for(int i = 0; i<3; i++) {
			for(int j = 0; j<3; j++) {
				int a = in.nextInt();
				given[i][j] = a%2;
				if(given[i][j]==1) {
					if(arr[i][j]==0) arr[i][j] = 1;
					else arr[i][j] = 0;
					if(i-1 >= 0) if(arr[i-1][j]==0) arr[i-1][j] = 1;
					else arr[i-1][j] = 0;
					if(i+1<=2) if(arr[i+1][j]==0) arr[i+1][j] = 1;
					else arr[i+1][j] = 0;
					if(j-1>=0) if(arr[i][j-1]==0) arr[i][j-1] = 1;
					else arr[i][j-1] = 0;
					if(j+1<=2) if(arr[i][j+1]==0) arr[i][j+1] = 1;
					else arr[i][j+1] = 0;
				}
			}
		}
		for(int i = 0; i<3; i++) {
			for(int j = 0; j<3; j++) {
				System.out.print(arr[i][j]);
			}
			System.out.println();
		}
	}
}

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		doIt();
	}

	static void doIt() {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int[][] lights = new int[3][3];
		boolean[][] bLight = new boolean[3][3];
		for (boolean[] bs : bLight) {
			Arrays.fill(bs, true);
		}
		for (int i = 0; i < lights.length; i++) {
			for (int j = 0; j < lights.length; j++) {
				lights[i][j] = sc.nextInt();
			}
		}
		int[][] dir = {{0,0}, {0,1}, {1, 0}, {-1, 0}, {0, -1}};
		for (int i = 0; i < lights.length; i++) {
			for (int j = 0; j < lights.length; j++) {
				int n = lights[i][j] % 2;
				if(n == 1){
					for(int k = 0; k < dir.length; k++) {
						int ii = i + dir[k][0];
						int jj = j + dir[k][1];
						if(0 <= ii && ii < 3 && 0<= jj && jj < 3) bLight[ii][jj] = bLight[ii][jj]? false: true;
					}
				}
			}
		}
		for (int i = 0; i < bLight.length; i++) {
			for (int j = 0; j < bLight.length; j++) {
				if(bLight[i][j]) System.out.print(1);
				else System.out.print(0);
				if(j == 2) System.out.println();
			}
		}
	}
}

/* package codechef; // don't place package name! */

import java.math.BigInteger;
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{
    // Complete the maximumSum function below.
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static boolean prime(long a){
        if(a==2||a==3)
            return true;
        if((a-1)%6==0)
            return true;
        if((a+1)%6==0)
            return true;
        return false;
    }
    public static  long gcd(long a,long b){
        if(b==0)
            return a;
        long r=a%b;
        return gcd(b,r);
    }

    static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

    public class ListNode {
        int val;
        ListNode next;
        ListNode() {}
        ListNode(int val) { this.val = val; }
        ListNode(int val, ListNode next) { this.val = val; this.next = next; }
    }

    public class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode() {}
      TreeNode(int val) { this.val = val; }
      TreeNode(int val, TreeNode left, TreeNode right) {
          this.val = val;
          this.left = left;
          this.right = right;
      }
    }

    class Node {
        public int val;
        public List<Node> children;

        public Node() {}

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    // private static final FastReader scanner = new FastReader();
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader scanner = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int arr[][]=new int[5][5];
        for(int i=1;i<=3;i++){
            for(int j=1;j<=3;j++){
                int x=scanner.nextInt();
                arr[i][j]=x%2;
            }
        }
        for(int i=1;i<=3;i++){
            for(int j=1;j<=3;j++){
                int x=(arr[i][j]+arr[i][j-1]+arr[i-1][j]+arr[i][j+1]+arr[i+1][j]+1)%2;
                w.print(x);
            }
            w.println();
        }
        w.close();
    }
}

import java.util.*;
import java.io.*;

public class a
{
   public static int[] di = {1,-1,0,0,0};
   public static int[] dj = {0,0,0,1,-1};
   public static void main(String[] Args)
   {
      Scanner sc = new Scanner(System.in);
      PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
      int[][] g = new int[3][3];

      for (int i = 0; i < 3; i++)
         for (int j = 0; j < 3; j++){
            int x = sc.nextInt()&1;
            for (int k = 0; k < 5; k++)
            {
               int ii = i + di[k];
               int jj = j + dj[k];
               if (jj < 3 && jj >= 0 && ii < 3 && ii >= 0)
                  g[ii][jj] ^= x;
            }
         }
      for (int i = 0; i < 3; i++, out.println())
         for (int j =0 ; j < 3; j++)
            out.print(g[i][j]^1);
      out.close();
   }
}

import java.io.BufferedReader;

import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader inp=new BufferedReader(new InputStreamReader(System.in));
int arr[][]=new int[3][3];
int arr1[][]=new int[3][3];
String line[];
for(int i=0;i<3;i++){
	line=inp.readLine().split(" ");
	for(int j=0;j<3;j++)
	{		arr[i][j]=Integer.parseInt(line[j]);
	}
}

for(int i=0;i<3;i++){

	for(int j=0;j<3;j++)
	{

		arr1[i][j]=arr[i][j];

		if(i-1>=0){
			arr1[i][j]+=arr[i-1][j];

		}
		if(j-1>=0){
			arr1[i][j]+=arr[i][j-1];
		}
		if(i+1<3){
			arr1[i][j]+=arr[i+1][j];
		}
		if(j+1<3){
			arr1[i][j]+=arr[i][j+1];
			}

//		if(i-1>=0&&j-1>=0){
//			arr1[i][j]+=arr[i-1][j-1];
//		}
//		if(i+1<3&&j+1<3){
//			arr1[i][j]+=arr[i+1][j+1];
//		}
//		if(i-1>=0&&j+1<3){
//			arr1[i][j]+=arr[i-1][j+1];
//		}
//		if(i+1<3&&j-1>=0){
//			arr1[i][j]+=arr[i+1][j-1];
//		}

	}
	}

for(int i=0;i<3;i++)
{
	for(int j=0;j<3;j++)
		 System.out.print((arr1[i][j]+1)%2);
	 System.out.println();
}
	}

}

import java.io.Writer;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.math.*;

public class A275{
  static class ProblemSolver{
    static int[][] changeState(int s[][], int i, int j, int k){
      try{
        s[i-1][j]^=k;
      }
      catch(Exception e){ }
      try{
        s[i+1][j]^=k;
      }
      catch(Exception e){ }
      try{
        s[i][j-1]^=k;
      }
      catch(Exception e){ }
      try{
        s[i][j+1]^=k;
      }
      catch(Exception e){ }
      return s;
    }
    public void solveTheProblem(InputReader in,OutputWriter out, NumberTheory nt){
      int test=1;//in.nextInt();
      while(test-- >0){
        int ar[][]= new int[3][3];
        ar=in.nextIntMatrix(3, 3);
        int s[][]= new int[3][3];
        for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
            s[i][j]=1;
          }
        }
        for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
            if(ar[i][j]%2==1){
              s[i][j]^=1;
              s=changeState(s, i, j, 1);
            }
          }
        }
        for(int i=0;i<3;i++){
          String ans="";
          for(int j=0;j<3;j++){
            ans+=s[i][j];
          }
          System.out.println(ans);
        }
      }
    }
  }

  public static void main(String[] args){
    InputStream inputStream=System.in;
    OutputStream outputStream=System.out;
    InputReader in=new InputReader(inputStream);
    OutputWriter out=new OutputWriter(outputStream);
    NumberTheory nt= new NumberTheory();
    ProblemSolver problemSolver=new ProblemSolver();
    problemSolver.solveTheProblem(in,out, nt);
    out.flush();
    out.close();
  }

  static class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int peek() {
      if (numChars == -1) {
        return -1;
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          return -1;
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar];
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public String nextLine() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      StringBuilder res = new StringBuilder();
      do {
        if (Character.isValidCodePoint(c)) {
          res.appendCodePoint(c);
        }
        c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
      StringBuilder buf = new StringBuilder();
      int c = read();
      while (c != '\n' && c != -1) {
        if (c != '\r') {
          buf.appendCodePoint(c);
        }
        c = read();
      }
      return buf.toString();
    }

    public String readLine() {
      String s = readLine0();
      while (s.trim().length() == 0) {
        s = readLine0();
      }
      return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
      if (ignoreEmptyLines) {
        return readLine();
      } else {
        return readLine0();
      }
    }

    public BigInteger readBigInteger() {
      try {
        return new BigInteger(nextLine());
      } catch (NumberFormatException e) {
        throw new InputMismatchException();
      }
    }

    public char nextCharacter() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      return (char) c;
    }

    public double nextDouble() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      double res = 0;
      while (!isSpaceChar(c) && c != '.') {
        if (c == 'e' || c == 'E') {
          return res * Math.pow(10, nextInt());
        }
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      }
      if (c == '.') {
        c = read();
        double m = 1;
        while (!isSpaceChar(c)) {
          if (c == 'e' || c == 'E') {
            return res * Math.pow(10, nextInt());
          }
          if (c < '0' || c > '9') {
            throw new InputMismatchException();
          }
          m /= 10;
          res += (c - '0') * m;
          c = read();
        }
      }
      return res * sgn;
    }

    public boolean isExhausted() {
      int value;
      while (isSpaceChar(value = peek()) && value != -1) {
        read();
      }
      return value == -1;
    }

    public String next() {
      return nextLine();
    }

    public SpaceCharFilter getFilter() {
      return filter;
    }

    public void setFilter(SpaceCharFilter filter) {
      this.filter = filter;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
    public int[] nextIntArray(int n){
      int[] array=new int[n];
      for(int i=0;i<n;++i)array[i]=nextInt();
      return array;
    }
    public int[] nextSortedIntArray(int n){
      int array[]=nextIntArray(n);
      Arrays.sort(array);
      return array;
    }
    public ArrayList<Integer> nextIntArrayList(int n){
      ArrayList<Integer> ar= new ArrayList<>();
      for(int i=0;i<n;i++)
        ar.add(nextInt());
      return ar;
    }
		public ArrayList<Long> nextLongArrayList(int n){
      ArrayList<Long> ar= new ArrayList<>();
      for(int i=0;i<n;i++)
        ar.add(nextLong());
      return ar;
    }

    public int[] nextSumIntArray(int n){
      int[] array=new int[n];
      array[0]=nextInt();
      for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
      return array;
    }
    public long[] nextLongArray(int n){
      long[] array=new long[n];
      for(int i=0;i<n;++i)array[i]=nextLong();
      return array;
    }
    public long[] nextSumLongArray(int n){
      long[] array=new long[n];
      array[0]=nextInt();
      for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
      return array;
    }
    public long[] nextSortedLongArray(int n){
      long array[]=nextLongArray(n);
      Arrays.sort(array);
      return array;
    }
    public int[][] nextIntMatrix(int n,int m){
      int[][] matrix=new int[n][m];
      for(int i=0;i<n;++i)
      for(int j=0;j<m;++j)
      matrix[i][j]=nextInt();
      return matrix;
    }

    public int[][] nextIntMatrix(int n){
      return nextIntMatrix(n,n);
    }

    public long[][] nextLongMatrix(int n,int m){
      long[][] matrix=new long[n][m];
      for(int i=0;i<n;++i)
      for(int j=0;j<m;++j)
      matrix[i][j]=nextLong();
      return matrix;
    }

    public long[][] nextLongMatrix(int n){
      return nextLongMatrix(n,n);
    }

    public char[][] nextCharMatrix(int n,int m){
      char[][] matrix=new char[n][m];
      for(int i=0;i<n;++i)
      matrix[i]=next().toCharArray();
      return matrix;
    }

    public char[][] nextCharMatrix(int n){
      return nextCharMatrix(n,n);
    }
  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    // public void print(char[] array) {
    //     writer.print(array);
    // }

    public void print(Object... objects) {
      for (int i = 0; i < objects.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(objects[i]);
      }
    }

    public void print(int[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(double[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(long[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(char[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(String[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(int[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(double[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(long[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(char[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(String[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void println(int[] array) {
      print(array);
      writer.println();
    }

    public void println(double[] array) {
      print(array);
      writer.println();
    }

    public void println(long[] array) {
      print(array);
      writer.println();
    }

    // public void println(char[] array) {
    //     print(array);
    //     writer.println();
    // }

    public void println(String[] array) {
      print(array);
      writer.println();
    }

    public void println() {
      writer.println();
    }

    public void println(Object... objects) {
      print(objects);
      writer.println();
    }

    public void print(char i) {
      writer.print(i);
    }

    public void println(char i) {
      writer.println(i);
    }

    public void println(char[] array) {
      writer.println(array);
    }

    public void printf(String format, Object... objects) {
      writer.printf(format, objects);
    }

    public void close() {
      writer.close();
    }

    public void flush() {
      writer.flush();
    }

    public void print(long i) {
      writer.print(i);
    }

    public void println(long i) {
      writer.println(i);
    }

    public void print(int i) {
      writer.print(i);
    }

    public void println(int i) {
      writer.println(i);
    }

    public void separateLines(int[] array) {
      for (int i : array) {
        println(i);
      }
    }
  }
  static class NumberTheory{

      /**
       * Modular Arithmetic:
       *  1. (a+b)%c=(a%c+b%c)%c
       *  2. (a*b)%c=(a%c*b%c)%c
       *  3. (a-b)%c=(a%c-b%c+c)%c
       *  4. (a/b)%c=(a%c*(b^-1)%c)%c -- (b^-1 is multiplicative modulo inverse)
       */
      //Modular Addition
      public int modularAddition(int a,int b,int MOD){
          return (a%MOD+b%MOD)%MOD;
      }
      public long modularAddition(long a,long b,long MOD){
          return (a%MOD+b%MOD)%MOD;
      }
      //Modular Multiplication
      public int modularMultiplication(int a,int b,int MOD){
          return ((a%MOD)*(b%MOD))%MOD;
      }
      public long modularMultiplication(long a,long b,long MOD){
          return ((a%MOD)*(b%MOD))%MOD;
      }
      //Modular Subtraction
      public int modularSubtraction(int a,int b,int MOD){
          return (a%MOD-b%MOD+MOD)%MOD;
      }
      public long modularSubtraction(long a,long b,long MOD){
          return (a%MOD-b%MOD+MOD)%MOD;
      }

      /**
       * Binary Exponentiation
       */
      public int binaryExponentiation(int x,int n){
          if(n==0)return 1;
          else if(n%2==0)return binaryExponentiation(x*x,n/2);
          else return x*binaryExponentiation(x*x,(n-1)/2);
      }
      public long binaryExponentiation(long x,long n){
          long result=1;
          while(n>0){
              if(n%2==1)result*=x;
              x=x*x;
              n/=2;
          }
          return result;
      }

      /**
       * Modular Exponentiation
       */
      public int modularExponentiation(int x,int n,int MOD){
          if(n==0)return 1%MOD;
          else if(n%2==0)return modularExponentiation(modularMultiplication(x,x,MOD),n/2,MOD);
          else return modularMultiplication(x,modularExponentiation(modularMultiplication(x,x,MOD),(n-1)/2,MOD),MOD);
      }
      public long modularExponentiation(long x,long n,long MOD){
          long result=1;
          while(n>0){
              if(n%2==1)result=modularMultiplication(result,x,MOD);
              x=modularMultiplication(x,x,MOD);
              n/=2;
          }
          return result;
      }

      /**
       * Factorial of a number
       */
      public long factorials(long n){
          if(n==0)return 1;
          return n*factorials(n-1);
      }

      /**
       * Prime factors of a number
       */
      public ArrayList<Integer> distinctPrimeFactors(int n){
          ArrayList<Integer> factorials=new ArrayList<>();
          int limit=(int)Math.sqrt(n);
          if(n%2==0){
              factorials.add(2);
              while(n%2==0)n/=2;
          }
          for(int i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Long> distinctPrimeFactors(long n){
          ArrayList<Long> factorials=new ArrayList<>();
          long limit=(long)Math.sqrt(n);
          if(n%2==0){
              factorials.add((long)2);
              while(n%2==0)n/=2;
          }
          for(long i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Integer> primeFactors(int n){
          ArrayList<Integer> factorials=new ArrayList<>();
          int limit=(int)Math.sqrt(n);
          if(n%2==0){
              factorials.add(2);
              while(n%2==0)n/=2;
          }
          for(int i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Long> primeFactors(long n){
          ArrayList<Long> factorials=new ArrayList<>();
          long limit=(long)Math.sqrt(n);
          if(n%2==0){
              factorials.add((long)2);
              while(n%2==0)n/=2;
          }
          for(long i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      /**
       * Combination: nCr
       */
      //Naive version
      //(n,r)=(n-1,r-1)+(n-1,r) for r!=0 or r!=n
      //(n,0)=(n,n)=1
      public int binomialCoefficientRecursive(int n,int k){
          if(k==0 || k==n)return 1;//base case
          return binomialCoefficientRecursive(n-1,k-1)+binomialCoefficientRecursive(n-1,k);//recursion
      }

      //Dynamic Programming version(Uses bottom up approach to fill the table)
      //Time complexity: O(n*k)
      //Space complexity: O(n*k)
      public long binomialCoefficientIterative(int n,int k){
          long[][] C=new long[n+1][k+1];
          for(int i=0;i<=n;++i){
              for(int j=0;j<=Math.min(n,k);++j){
                  if(j==0 || j==i)C[i][j]=1;
                  else C[i][j]=C[i-1][j-1]+C[i-1][j];
              }
          }
          return C[n][k];
      }

      //Pascal's Triangle version(Space efficient program)
      //Time complexity: O(n*k)
      //Space complexity: O(k)
      public long nCr(int n,int r){
          int[] C=new int[r+1];
          C[0]=1;//nC0=1
          for(int i=1;i<=n;++i)
              for(int j=Math.min(i,r);j>0;--j)
                  C[j]=C[j]+C[j-1];
          return C[r];
      }

      /**
       * Catlan number:
       *  - Time complexity: O(n*n)
       *  - Auxiliary space: O(n)
       *
       *  NOTE: Time complexity could be reduced to O(n) but it is
       *        possible if and only if n is small or else there is
       *        a chance of getting an overflow. To decrease the time
       *        complexity to O(n) just remember nCr=nCn-r
       */
      public long catlanNumber(int n){
          long[] catlan=new long[n+1];
          catlan[0]=catlan[1]=1;
          for(int i=2;i<=n;++i)
              for(int j=0;j<i;++j)
                  catlan[i]+=catlan[j]*catlan[i-1-j];

          return catlan[n];
      }

      /**
       * Greatest Common Divisor(GCD)
       *  - It is also known as Highest Common Factor(HCF)
       *  - Time complexity: log(min(a,b))
       *  - Auxiliary Space: O(1)
       */
      public int gcd(int a,int b){
          if(b==0)return a;
          return gcd(b,a %b);
      }

      public long gcd(long a,long b){
          if(b==0)return a;
          return gcd(b,a%b);
      }

      /**
       * Extended Euclid's Algorithm:
       *  - ax+by=gcd(a,b)
       *  - Time complexity:
       *  -
       */

      /**
       * Least Common Multiple(LCM):
       *  - Time complexity: log(min(a,b))
       *  - Auxiliary Space: O(1)
       */
      public long lcm(long a,long b){
          return (a*b)/gcd(a,b);
      }

  }
}
//
//                       "8,        .m8"
//                        I8Im    ,mI8"
//                        ,8I""I8,mI8m
//             "I8mm,    ,I8    I8 "I8,          ,m"
//                "I88I88I8m ,I8"   "I8""==mm ,mI8"
//        ___    ,mI8"    "8I8"      I8,  ,mI8I8"
//   .,mI8I8I8I8I88,      ,m8"      ,I8I8I8I888"
// "I8Im,       "I88,    ,8"      ,II8"     "88,
//    `"I8,        "I8, ,8"     ,I8"         "I8,
//       "I8m       "I888      ,I8"           "I8,
//         "8m        "I8      88"              "I8,
//          I8,        I8      88                 "I8,
//           88,       I8,     "I8                 "I8
//           "I8,      "I8,     "I8,                I8;.
//            "I8,      "I8,      "I8        .,mmmI8888888m,.
//              I8,      "I8,      I8,  .mI8I88"""". .. "I8888
//              "I8,      "I8      mI8I88"". . . . . .,m8"   "8
//               I8m,  __ ;I8   ,II88" . . . . .,;miI88"
//               "I88I8I88I88,,I88" . . . ,mmiiI8888"
//                ,I8". . ."I8I8". . . mi888888888"
//              ,I8 . . . .,I88I. . .i88888888888"
//             I8. . . .,mII88Ima. .i88888888888"
//            ,8"..,mI88I88I88I8Imi888888888888"
//            I8.,I8I"""        ""II88888888888
//           ;I8I8"                  ""I8888888
//           ""                         "I88888
//                                        "I888
//                                         "I88,
//                                          "I88
//                                           "88,
//                                            I88,              ______   __
//                           ______           "I88__        .mI88I88I88I88I88,
//                      .,mI88I88I88, ,mI88,   I88"""     ,mI8". . . . "I8,..8,
//                    ,I888' . . . "I88.\ "8,  I88      ,I8". . . .  / :;I8 \ 8,
//                  .mI8' . . .  / .:"I8.\ 88  "88,    ,8". . .  / .;mI8I8I8,\ 8
//                 ,I8'. . .  / . .:;,I8I8I888  I88   ,8". .  / .:mI8"'   "I8,:8
//                ,I8'. . . / . .:;,mI8"  `"I88 I88   I8. .  / .m8"         "I8I
//               ,I8 . .  / . .:;,mI8"      "I88888   88,.  / ,m8            "8'
//               I8'. .  / . .;,mI8"          "II888 ,I8I8,.,I8"
//               I8 . . / . .,mI8"              I8888888' """
//               `I8,.  / ;,mI8"                 II888
//                "I8I, /,mI8"                 __I888
//                  "I8888"                   """I88
//                    ""                         I88
//                                               I88__
//                                               I88"""
//                                               I88
//                                               I88
//                                             __I88
//                                            """I88
//                                               I88
//                                               I88
//                                               I88__
//                                               I88"""
//                                               I88
//                                        BITSY  ___  CHUCK

import java.util.Scanner;

public class O {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		boolean flag=true;
		Scanner sc=new Scanner(System.in);
		int[][] cntArr=new int[3][3];
		int cnt;
		for(int i=0;i<3;i++) {
			for(int j=0;j<3;j++) {
				cntArr[i][j]=sc.nextInt();
			}
		}
		int[][] bulb=new int[3][3];
		for(int i=0;i<3;i++) {
			for(int j=0;j<3;j++) {
				bulb[i][j]=1;
			}
		}
		while(flag)
		{
			cnt=0;
			for(int i=0;i<3;i++) {
				for(int j=0;j<3;j++) {
					if(cntArr[i][j]>0)
					{
						bulb[i][j]=Math.abs(bulb[i][j] -1);
						if(j-1>=0)
							bulb[i][j-1]=Math.abs(bulb[i][j-1] -1);
						if(i-1>=0)
							bulb[i-1][j]=Math.abs(bulb[i-1][j] -1);
						if(j+1<=2)
							bulb[i][j+1]=Math.abs(bulb[i][j+1] -1);
						if(i+1<=2)
							bulb[i+1][j]=Math.abs(bulb[i+1][j] -1);
						cntArr[i][j]=cntArr[i][j]-1;
						cnt+=1;
						//System.out.println("cnt" +cnt);

					}

				}
			}
			if(cnt==0) {
				flag=false;
			}

		}

		for(int i=0;i<3;i++) {
			for(int j=0;j<3;j++) {
				System.out.print(bulb[i][j]);
			}
			System.out.println("");
		}
	}

}

import java.io.*;import java.util.*;import java.math.*;
public class A
{
    static long mod=1000000007l;
    static int max=Integer.MAX_VALUE,min=Integer.MIN_VALUE;
    static long maxl=Long.MAX_VALUE,minl=Long.MIN_VALUE;
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out=new PrintWriter(System.out);
    static StringTokenizer st;
    static StringBuilder sb;

    static public void main(String[] args)throws Exception
    {
        st=new StringTokenizer(br.readLine());
        //int t=i();
        sb=new StringBuilder(1000000);
        int t = 1 ;
        while(t-->0) {
            int[][] a = new int[3][3] ;
            for(int i=0;i<3;i++){
                for(int j=0;j<3;j++){
                    a[i][j] = i() ;
                }
            }
            int[][] ans = {{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1}} ;
           // System.out.println(ans.length + " " + ans[0].length);
            for(int i=0;i<3;i++){
                for(int j=0;j<3;j++){
                    if(a[i][j]==0) continue;
                    int val = a[i][j]%2 ;
                    if(val==1){
                        ans[i+1][j+1] = abs(ans[i+1][j+1] -1) ;
                        ans[i][j+1] = abs(ans[i][j+1] -1) ;
                        ans[i+2][j+1] = abs(ans[i+2][j+1] -1) ;
                        ans[i+1][j] = abs(ans[i+1][j] -1) ;
                        ans[i+1][j+2] = abs(ans[i+1][j+2] -1) ;
                    }
                }
            }
            for(int i=1;i<4;i++){
                for(int j=1;j<4;j++){
                    out.print(ans[i][j]);
                }
                out.println();
            }
        }
        out.flush();
        out.close();
    }

    static void s(String s){sb.append(s);}
    static void s(int s){sb.append(s);}
    static void s(long s){sb.append(s);}
    static void s(char s){sb.append(s);}
    static void s(double s){sb.append(s);}
    static void ss(){sb.append(' ');}
    static void sl(String s){sb.append(s);sb.append("\n");}
    static void sl(int s){sb.append(s);sb.append("\n");}
    static void sl(long s){sb.append(s);sb.append("\n");}
    static void sl(char s){sb.append(s);sb.append("\n");}
    static void sl(double s){sb.append(s);sb.append("\n");}
    static void sl(){sb.append("\n");}
    static int max(int a,int b){return a>b?a:b;}
    static int min(int a,int b){return a<b?a:b;}
    static int abs(int a){return Math.abs(a);}
    static int floor(int a){return (int)Math.floor(a);}
    static int ceil(int a){return (int)Math.ceil(a);}
    static long max(long a,long b){return a>b?a:b;}
    static long min(long a,long b){return a<b?a:b;}
    static long abs(long a){return Math.abs(a);}
    static int sq(int a){return (int)Math.sqrt(a);}
    static long sq(long a){return (long)Math.sqrt(a);}
    static int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
    static boolean pa(String s,int i,int j)
    {
        while(i<j)if(s.charAt(i++)!=s.charAt(j--))return false;
        return true;
    }
    static int ncr(int n,int c,long m)
    {
        long a=1l;
        for(int x=n-c+1;x<=n;x++)a=((a*x)%m);
        long b=1l;
        for(int x=2;x<=c;x++)b=((b*x)%m);
        return (int)((a*(mul((int)b,m-2,m)%m))%m);
    }
    static boolean[] sieve(int n)
    {
        boolean bo[]=new boolean[n+1];
        bo[0]=true;bo[1]=true;
        for(int x=4;x<=n;x+=2)bo[x]=true;
        for(int x=3;x*x<=n;x+=2)if(!bo[x])for(int y=x*x;y<=n;y+=x)bo[y]=true;
        return bo;
    }
    static long fac(long n){
        if(n==0 || n==1) return 1 ;
        else return 1L*n*fac(n-1) ;
    }
    static long mul(long a,long b,long m)
    {
        long r=1l;
        a%=m;
        while(b>0)
        {
            if((b&1)==1)r=(r*a)%m;
            b>>=1;
            a=(a*a)%m;
        }
        return r;
    }
    static int i()throws IOException
    {
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        return st.nextToken();
    }
    static double d()throws IOException
    {
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        return Double.parseDouble(st.nextToken());
    }
    static void p(Object p){System.out.print(p);}
    static void p(String p){System.out.print(p);}
    static void p(int p){System.out.print(p);}
    static void p(double p){System.out.print(p);}
    static void p(long p){System.out.print(p);}
    static void p(char p){System.out.print(p);}
    static void p(boolean p){System.out.print(p);}
    static void pl(Object p){System.out.println(p);}
    static void pl(String p){System.out.println(p);}
    static void pl(int p){System.out.println(p);}
    static void pl(char p){System.out.println(p);}
    static void pl(double p){System.out.println(p);}
    static void pl(long p){System.out.println(p);}
    static void pl(boolean p){System.out.println(p);}
    static void pl(){System.out.println();}
    static int[] ari(int n)throws IOException
    {
        int ar[]=new int[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++)ar[x]=Integer.parseInt(st.nextToken());
        return ar;
    }
    static int[][] ari(int n,int m)throws IOException
    {
        int ar[][]=new int[n][m];
        for(int x=0;x<n;x++)
        {
            if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
            for(int y=0;y<m;y++)ar[x][y]=Integer.parseInt(st.nextToken());
        }
        return ar;
    }
    static long[] arl(int n)throws IOException
    {
        long ar[]=new long[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++) ar[x]=Long.parseLong(st.nextToken());
        return ar;
    }
    static long[][] arl(int n,int m)throws IOException
    {
        long ar[][]=new long[n][m];
        for(int x=0;x<n;x++)
        {
            if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
            for(int y=0;y<m;y++)ar[x][y]=Long.parseLong(st.nextToken());
        }
        return ar;
    }
    static String[] ars(int n)throws IOException
    {
        String ar[]=new String[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++) ar[x]=st.nextToken();
        return ar;
    }
    static double[] ard(int n)throws IOException
    {
        double ar[]=new double[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++)ar[x]=Double.parseDouble(st.nextToken());
        return ar;
    }
    static double[][] ard(int n,int m)throws IOException
    {
        double ar[][]=new double[n][m];
        for(int x=0;x<n;x++)
        {
            if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
            for(int y=0;y<m;y++)ar[x][y]=Double.parseDouble(st.nextToken());
        }
        return ar;
    }
    static char[] arc(int n)throws IOException
    {
        char ar[]=new char[n];
        if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());
        for(int x=0;x<n;x++)ar[x]=st.nextToken().charAt(0);
        return ar;
    }
    static char[][] arc(int n,int m)throws IOException
    {
        char ar[][]=new char[n][m];
        for(int x=0;x<n;x++)
        {
            String s=br.readLine();
            for(int y=0;y<m;y++)ar[x][y]=s.charAt(y);
        }
        return ar;
    }
    static void p(int ar[])
    {
        StringBuilder sb=new StringBuilder(2*ar.length);
        for(int a:ar)
        {
            sb.append(a);
            sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(int ar[][])
    {
        StringBuilder sb=new StringBuilder(2*ar.length*ar[0].length);
        for(int a[]:ar)
        {
            for(int aa:a)
            {
                sb.append(aa);
                sb.append(' ');
            }
            sb.append("\n");
        }
        p(sb);
    }
    static void p(long ar[])
    {
        StringBuilder sb=new StringBuilder(2*ar.length);
        for(long a:ar)
        {
            sb.append(a);
            sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(long ar[][])
    {
        StringBuilder sb=new StringBuilder(2*ar.length*ar[0].length);
        for(long a[]:ar)
        {
            for(long aa:a)
            {
                sb.append(aa);
                sb.append(' ');
            }
            sb.append("\n");
        }
        p(sb);
    }
    static void p(String ar[])
    {
        int c=0;
        for(String s:ar)c+=s.length()+1;
        StringBuilder sb=new StringBuilder(c);
        for(String a:ar)
        {
            sb.append(a);
            sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(double ar[])
    {
        StringBuilder sb=new StringBuilder(2*ar.length);
        for(double a:ar)
        {
            sb.append(a);
            sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(double ar[][])
    {
        StringBuilder sb=new StringBuilder(2*ar.length*ar[0].length);
        for(double a[]:ar)
        {
            for(double aa:a)
            {
                sb.append(aa);
                sb.append(' ');
            }
            sb.append("\n");
        }
        p(sb);
    }
    static void p(char ar[])
    {
        StringBuilder sb=new StringBuilder(2*ar.length);
        for(char aa:ar)
        {
            sb.append(aa);
            sb.append(' ');
        }
        System.out.println(sb);
    }
    static void p(char ar[][])
    {
        StringBuilder sb=new StringBuilder(2*ar.length*ar[0].length);
        for(char a[]:ar)
        {
            for(char aa:a)
            {
                sb.append(aa);
                sb.append(' ');
            }
            sb.append("\n");
        }
        p(sb);
    }
}

import java.util.Scanner;

public class LightsOut {
    public static void main(String[] args) {
        boolean[][] lights = {{true, true, true}, {true, true, true}, {true, true, true}};
        int[][] numberOfToggles = new int[3][3];
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                numberOfToggles[i][j] = scanner.nextInt();
                if (numberOfToggles[i][j] % 2 == 0) {
                    numberOfToggles[i][j] = 0;
                }
                else {
                    numberOfToggles[i][j] = 1;
                }
            }
            scanner.nextLine();
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {

                if(numberOfToggles[0][0] == 1)
                {
                    lights[0][0] = !lights[0][0];
                    lights[1][0] = !lights[1][0];
                    lights[0][1] = !lights[0][1];
                }

                if(numberOfToggles[1][0] == 1)
                {
                    lights[1][0] = !lights[1][0];
                    lights[0][0] = !lights[0][0];
                    lights[2][0] = !lights[2][0];
                    lights[1][1] = !lights[1][1];
                }

                if(numberOfToggles[2][0] == 1)
                {
                    lights[2][0] = !lights[2][0];
                    lights[2][1] = !lights[2][1];
                    lights[1][0] = !lights[1][0];

                }

                if(numberOfToggles[0][1] == 1)
                {
                    lights[0][1] = !lights[0][1];
                    lights[0][0] = !lights[0][0];
                    lights[1][1] = !lights[1][1];
                    lights[0][2] = !lights[0][2];
                }

                if(numberOfToggles[1][1] == 1)
                {
                    lights[1][1] = !lights[1][1];
                    lights[0][1] = !lights[0][1];
                    lights[2][1] = !lights[2][1];
                    lights[1][0] = !lights[1][0];
                    lights[1][2] = !lights[1][2];

                }

                if(numberOfToggles[2][1] == 1)
                {
                    lights[2][1] = !lights[2][1];
                    lights[1][1] = !lights[1][1];
                    lights[2][0] = !lights[2][0];
                    lights[2][2] = !lights[2][2];

                }

                if(numberOfToggles[0][2] == 1)
                {
                    lights[0][2] = !lights[0][2];
                    lights[0][1] = !lights[0][1];
                    lights[1][2] = !lights[1][2];
                }

                if(numberOfToggles[1][2] == 1)
                {
                    lights[1][2] = !lights[1][2];
                    lights[0][2] = !lights[0][2];
                    lights[1][1] = !lights[1][1];
                    lights[2][2] = !lights[2][2];
                }

                if(numberOfToggles[2][2] == 1)
                {
                    lights[2][2] = !lights[2][2];
                    lights[2][1] = !lights[2][1];
                    lights[1][2] = !lights[1][2];
                }
            }
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (lights[i][j]) {
                    System.out.print("1");
                }
                else {
                    System.out.print("0");
                }
            }
            System.out.println();
        }
    }
}

import java.util.*;

import java.lang.*;
import java.io.*;

public class Solution
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    private static FastReader sc= new FastReader();
	public static void main (String[] args) throws java.lang.Exception
	{

        int[][] a = new int[5][5];
        for(int i=1;i<4;i++){
            for(int j=1;j<4;j++){
                a[i][j]=sc.nextInt();

            }
        }

        for(int i=1;i<4;i++){
            for(int j=1;j<4;j++){
                int n= a[i][j]+a[i][j+1]+a[i][j-1]+a[i+1][j]+a[i-1][j];

                if(n%2==0){
                    System.out.print(1);

                }
                else{
                    System.out.print(0);
                }
            }
            System.out.println();
        }

	}
}

//package codeforces;

import java.util.Scanner;

public class LightsOut {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[][] ar = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}};
        for (int i = 0; i < ar.length; i++) {
            for (int j = 0; j < ar.length; j++) {
                int temp = input.nextInt();
                if ((temp & 1) == 1) {
                    ar[i][j]=(1 - ar[i][j]) % 2;
                    if (i + 1 < ar.length)
                        ar[i + 1][j] = (1 - ar[i+1][j]) % 2;
                    if (i > 0)
                        ar[i - 1][j] = (1 - ar[i-1][j]) % 2;
                    if (j + 1 < ar.length)
                        ar[i][j + 1] = (1 - ar[i][j+1]) % 2;
                    if (j > 0)
                        ar[i][j - 1] = (1 - ar[i][j-1]) % 2;

                }
            }

        }

        for (int i = 0; i < ar.length; i++) {
            for (int j = 0; j < ar.length; j++) {
                System.out.print(ar[i][j]);
            }
            System.out.print("\n");

        }
    }
}

import java.util.*;
import java.util.stream.IntStream;

public class CodeForces{

	public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  int a[][] = new int[5][5];
	  for(int i=1; i<=3; i++) {
		  for(int j=1; j<=3; j++) {
			  a[i][j]=sc.nextInt();

		  }
	  }
	  for(int i=1; i<=3; i++) {
		  for(int j=1; j<=3; j++) {
			  if ((a[i][j] + a[i][j + 1] + a[i + 1][j] + a[i - 1][j] + a[i][j - 1]) % 2 == 0) {
                  System.out.print("1");
              } else {
                  System.out.print("0");
              }
		  }
		  System.out.println();}

	 }

	  }

import java.util.*;

public class Lightsout {

    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);

        boolean x[][] = {{true, true, true}, {true, true, true}, {true, true, true}};
        int y;

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                y = s.nextInt();

                for (int z = 0; z < y; z++) {
                    switch (i) {
                        case 0:
                            switch (j) {
                                case 0:
                                    x[i][j] = !x[i][j];
                                    x[i + 1][j] = !x[i + 1][j];
                                    x[i][j + 1] = !x[i][j + 1];
                                    break;
                                case 1:
                                    x[i][j] = !x[i][j];
                                    x[i][j + 1] = !x[i][j + 1];
                                    x[i][j - 1] = !x[i][j - 1];
                                    x[i + 1][j] = !x[i + 1][j];
                                    break;
                                case 2:
                                    x[i][j] = !x[i][j];
                                    x[i + 1][j] = !x[i + 1][j];
                                    x[i][j - 1] = !x[i][j - 1];
                            }
                            break;
                        case 1:
                            switch (j) {
                                case 0:
                                    x[i][j] = !x[i][j];
                                    x[i][j + 1] = !x[i][j + 1];
                                    x[i - 1][j] = !x[i - 1][j];
                                    x[i + 1][j] = !x[i + 1][j];
                                    break;
                                case 1:
                                    x[i][j] = !x[i][j];
                                    x[i - 1][j] = !x[i - 1][j];
                                    x[i + 1][j] = !x[i + 1][j];
                                    x[i][j + 1] = !x[i][j + 1];
                                    x[i][j - 1] = !x[i][j - 1];
                                    break;
                                case 2:
                                    x[i][j] = !x[i][j];
                                    x[i][j - 1] = !x[i][j - 1];
                                    x[i - 1][j] = !x[i - 1][j];
                                    x[i + 1][j] = !x[i + 1][j];
                                    break;

                            }
                            break;
                        case 2:
                            switch (j) {
                                case 0:
                                    x[i][j] = !x[i][j];
                                    x[i - 1][j] = !x[i - 1][j];
                                    x[i][j + 1] = !x[i][j + 1];
                                    break;
                                case 1:
                                    x[i][j] = !x[i][j];
                                    x[i - 1][j] = !x[i - 1][j];
                                    x[i][j + 1] = !x[i][j + 1];
                                    x[i][j - 1] = !x[i][j - 1];
                                    break;
                                case 2:
                                    x[i][j] = !x[i][j];
                                    x[i - 1][j] = !x[i - 1][j];
                                    x[i][j - 1] = !x[i][j - 1];
                                    break;
                            }
                            break;
                    }

                }

            }
        }
        int z[][] = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (x[i][j] == true) {
                    z[i][j] = 1;
                } else {
                    z[i][j] = 0;
                }
                System.out.print(z[i][j]);
            }
            System.out.println();

        }
    }

}

import java.util.*;

public class Z275A {

	public static void main(String[] args) {

		Scanner inputScanner = new Scanner(System.in);

		int matrica[][] = new int[3][3];

		for(int i=0;i<3;++i) {
			for(int j=0;j<3;++j) {
				matrica[i][j] = inputScanner.nextInt();
			}
		}

		for(int i=0;i<3;++i) {
			for(int j=0;j<3;++j) {

				int suma = 0;

				for(int q=-1;q<=1;++q) {
					int pos_i = i+q;

					if(pos_i >= 0 && pos_i <= 2) {
						suma += matrica[pos_i][j];
					}
				}
				for(int q=-1;q<=1;++q) {
					int pos_i = j+q;

					if(pos_i >= 0 && pos_i <= 2) {
						suma += matrica[i][pos_i];
					}
				}

				suma -= matrica[i][j];

				System.out.print((suma+1)%2);
			}

			System.out.println();
		}

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A275 {
    FastReader io = new FastReader();

    public static void main(String[] args) {
        A275 n = new A275();
        n.run();
    }

    public void run() {
        int[][] lights = new int[3][3];
        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) {
                lights[i][j] = (io.nextInt() % 2);
            }
        }

        boolean[][] res = new boolean[3][3];

        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) {
                if(lights[i][j] > 0) {
                    switchL(i, j, res);
                }
            }
        }

        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++) {
                System.out.print(res[i][j] ? 0 : 1);
            }
            System.out.println();
        }

    }

    private void switchL(int i, int j, boolean[][] res) {
        res[i][j] = !res[i][j];
        if(i > 0) res[i - 1][j] = !res[i - 1][j];
        if(i < 2) res[i + 1][j] = !res[i + 1][j];
        if(j > 0) res[i][j -1 ] = !res[i][j - 1];
        if(j < 2) res[i ][j+1] = !res[i][j+ 1];
    }

public static class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }

    public String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public long nextLong()
    {
        return Long.parseLong(next());
    }

    public double nextDouble()
    {
        return Double.parseDouble(next());
    }

    public String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tushar Paliwal
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ALightsOut solver = new ALightsOut();
        solver.solve(1, in, out);
        out.close();
    }

    static class ALightsOut {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            boolean lights[][] = new boolean[10][10];
            for (int i = 0; i < lights.length; i++) {
                Arrays.fill(lights[i], true);
            }

            int move;

            int mov[][] = {{0, 0}, {0, 1}, {0, -1}, {1, 0}, {-1, 0}};
            for (int i = 1; i < 4; i++) {
                for (int j = 1; j < 4; j++) {
                    move = in.nextInt();
                    move = move % 2;
                    if (move != 0) {
                        for (int a[] : mov) {
                            lights[i + a[0]][j + a[1]] = !lights[i + a[0]][j + a[1]];
                        }
                    }
                }
            }

            for (int i = 1; i < 4; i++) {
                for (int j = 1; j < 4; j++) {
                    out.print(lights[i][j] ? 1 : 0);
                }
                out.println();
            }
        }

    }
}

import java.util.*;
import java.lang.*;

public final class complex {
	// get absolute value
	static int abs(int a) {
		int res = a>0 ? a : -a;
		return res;
	}
	// O(n) Arraysum
	static int ArraySum(int[] ar) {
		int sum=0;
		for (int i:ar)
			sum+=i;
		return sum;
	}
	// simple primality test - not efficient
	static boolean isPrime(int n) {
		if (n==1)
			return true;
		else if (n%2==0)
			return true;
		// checking only for add nums
		for (int i=3; i*i<n; i+=2) {
			if (n%i==0)
				return false;
		}
		return true;
	}
	// number conevrted in an array
	static int[] numtoarray(Integer a) {
		// caution: this method returns reversed number
		int[] ar=new int[a.toString().length()];

		for (int i=0; i<ar.length; i++) {
			ar[i]=a%10;
			a-=(a%10);
			a/=10;
		}
		return ar;
	}
	// sum of digits
	static int digitsum(int a, int sum) {
		sum+=a%10;
		a-=(a%10);
		a/=10;
		if (a==0)
			return sum;
		return digitsum(a, sum);
	}
	// binary exponentiation
	static long binpow(int a, int b) {
		if (b==0)
			return 1;
		long res=binpow(a, b/2);
		if (b%2==1)
			return res*res*a;
		else
			return res*res;
	}
	// euclidean gcd algorithm
	static int gcd(int a, int b) {
		return b!=0 ? gcd (b, a % b) : a;
	}
	// lcm through gcd
	static long lcm(int a, int b) {
		return (a*b)/gcd(a, b);
	}
	// sieve of eratosthenes
	static boolean[] sieve(int n) {
		boolean prime[] = new boolean[n+1];
        for(int i=2;i<n;i++)
            prime[i] = true;

        for(int p=2; p*p<=n; p++) {
            if(prime[p] == true) {
                for(int i=p*2; i<=n; i+=p)
                    prime[i] = false;
            }
        }
        return prime;
	}
	// bionomial coefficient nCk
	static long binomialCoeff(int n, int k) {
        long res = 1;
          if (k > n - k)
            k = n - k;

        for (int i = 0; i < k; ++i) {
            res *= (n - i);
            res /= (i + 1);
        }
        return res;
    }
    // catalan number using binomialCoeff O(n)
    static long catalan(int n) {
        long c = binomialCoeff(2 * n, n);
        return c / (n + 1);
    }
	// Integer factorization (not working for 6)
	static ArrayList<Integer> factorize(int n) {
		ArrayList<Integer> ar=new ArrayList<Integer>();
		for (int i=2; i*i<=n; i++) {
			while(n%i==0) {
				ar.add(i);
				n/=i;
			}
		}
		return ar;
	}
	// check if array is sorted (non-decreasing)
	static boolean ArraySorted(int arr[]) {
		int n=arr.length;
        if (n==1 || n==0)
            return true;

        if (arr[n-1]<arr[n-2])
            return false;
        return ArraySorted(arr);
    }
    static boolean meth(Integer n) {
    	int[] ar=new int[4];
    	int i=0;
    	while(n>0) {
    		ar[i++]=n%10;
    		n=(n-(n%10))/10;
    	}
    	boolean res=true;
    	for (int j=0; j<3; j++) {
    		for (int k=j+1; k<4; k++) {
    			if (ar[j]==ar[k]) {
    				res=false;
    				break;
    			}
    		}
    	}
    	// System.out.println(res);
    	return res;
    }
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		// int t=sc.nextInt();
		// while(t-->0) {
		// 	int n=sc.nextInt();
		// 	// ArrayList<Integer> res=new ArrayList<Integer>();

		// 	int[] ar=new int[n];
		// 	for (int i=0; i<n; i++) {
		// 		ar[i]=sc.nextInt();
		// 	}

		// 	System.out.println();
		// }

		int[][] moves=new int[3][3];
		int[][] ar=new int[5][5];
		for (int i=0; i<3; i++) {
			for (int j=0; j<3; j++) {
				moves[i][j]=sc.nextInt();
				int temp=moves[i][j];
				ar[i+1][j+1]+=temp;
				ar[i+1][j]+=temp;
				ar[i][j+1]+=temp;
				ar[i+2][j+1]+=temp;
				ar[i+1][j+2]+=temp;
			}
		}

		for (int i=1; i<4; i++) {
			for (int j=1; j<4; j++) {
				if (ar[i][j]%2==0)
					System.out.print(1);
				else
					System.out.print(0);
			}
			System.out.println();
		}
	}
}

import java.util.*;
public final class LightsOut {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int board[][] = {{1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {1, 1, 1, 1, 1}};

		int keypressed[][] = new int[5][5];

		for (int i = 1; i < 4; i++) {
			for (int j = 1; j < 4; j++) {
				keypressed[i][j] = sc.nextInt();
				if (keypressed[i][j] % 2 != 0) {
					board[i][j] = (board[i][j] == 1) ? 0 : 1;

					board[i][j + 1] = (board[i][j + 1] == 1) ? 0 : 1;
					board[i][j - 1] = (board[i][j - 1] == 1) ? 0 : 1;
					board[i + 1][j] = (board[i + 1][j] == 1) ? 0 : 1;
					board[i - 1][j] = (board[i - 1][j] == 1) ? 0 : 1;
				}

			}
		}
		for (int i = 1; i < 4; i++) {
			for (int j = 1; j < 4; j++) {
				System.out.print(board[i][j]);
			}
			System.out.println();
		}
	}
}

import java.util.*;
public class P6 {
    public static void change(int mat[][],int i,int j,int sol[][])
    {
        int ar[][]={{i-1,j},{i,j+1},{i+1,j},{i,j-1}};
        if(sol[i][j]==0)
            sol[i][j]=1;
        else
            sol[i][j]=0;
       for(int k=0;k<4;k++)
       {
           int u=ar[k][0];
           int v=ar[k][1];
           if(u>=0&&u<3&&v>=0&&v<3)
           {
               if(sol[u][v]==1)
                   sol[u][v]=0;
               else
                   sol[u][v]=1;
           }

       }

    }
    public static void main(String[] args)  {
        Scanner sc=new Scanner(System.in);
        int mat[][]=new int[3][3];
        int sol[][]=new int[3][3];
        for(int rows[]:sol)
            Arrays.fill(rows,1);
        int i,j;
        for( i=0;i<3;i++)
        {
            for( j=0;j<3;j++)
            {
                mat[i][j]=sc.nextInt();
            }
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                if(mat[i][j]%2!=0)
                {
                    change(mat,i,j,sol);
                }
            }
        }
        for( i=0;i<3;i++)
        {
            for( j=0;j<3;j++)
            {
                System.out.print(sol[i][j]);
            }
            System.out.println();
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class light {

    public static void main(String[] args) throws IOException, InterruptedException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);
      //  StringBuilder sb = new StringBuilder("");
        int a[][] = new int[5][5];

        for(int i=1;i<4;i++)
        	for(int j=1;j<4;j++)
        		a[i][j]= in.nextInt();

        for(int i=1;i<4;i++)
        {	for(int j=1;j<4;j++)
        		{if((a[i][j] + a[i-1][j] + a[i][j-1] + a[i+1][j] + a[i][j+1]) % 2 == 0)
     	    	   writer.print("1");
     	         else
     	    	   writer.print("0");
        		}
            writer.println();
        }
      //  writer.println(sb.toString());
        writer.close();
        in.close();
    }
}

class FastScanner {

    BufferedReader reader;
    StringTokenizer tokenizer;

    public FastScanner(InputStream stream) {
        this.reader = new BufferedReader(new InputStreamReader(stream));
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public int[] nextIntegerArray(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    public long[] nextLongArray(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    public int nextInt(int radix) throws IOException {
        return Integer.parseInt(next(), radix);
    }

    public long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public long nextLong(int radix) throws IOException {
        return Long.parseLong(next(), radix);
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public BigInteger nextBigInteger() throws IOException {
        return new BigInteger(next());
    }

    public BigInteger nextBigInteger(int radix) throws IOException {
        return new BigInteger(next(), radix);
    }

    public String next() throws IOException {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
            return this.next();
        }
        return tokenizer.nextToken();
    }

    public void close() throws IOException {
        this.reader.close();
    }
}

import java.util.Arrays;
import java.util.Scanner;
import static java.lang.Math.*;

public class Main {

     static int matriz[][] ;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        matriz= new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                    int a=in.nextInt();
                    solve(i, j,a);
                matriz[i][j]+=a;
            }
        }

        for (int i = 0; i < 3; i++) {
            System.out.println(abs(matriz[i][0]%2-1)+""+abs(matriz[i][1]%2-1)+""+abs(matriz[i][2]%2-1));
        }

    }

      static  int movesX[] = {0, 0, 1, -1};
    static int movesY[] = {1, -1, 0, 0};

    private static void solve(int i, int j,int a) {
        for (int k = 0; k < 4; k++) {
            int X1=i+movesX[k];
            int Y1=j+movesY[k];

            if(X1>=0&&Y1>=0&&X1<3&&Y1<3){
                //matriz[X1][Y1]=Math.abs(matriz[X1][Y1]-1);

                matriz[X1][Y1]+=a;
            }
        }
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author vadimmm
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int[][] matrix = new int[3][3];
        for (int i = 0; i < 3; ++i)
            for (int j = 0; j < 3; ++j)
                matrix[i][j] = in.nextInt();
        int[][] answer = new int[3][3];
        answer[0][0] = (matrix[0][0] + matrix[1][0] + matrix[0][1]) % 2;
        answer[0][1] = (matrix[0][0] + matrix[0][1]  + matrix[0][2] + matrix[1][1]) % 2;
        answer[0][2] = (matrix[0][1] + matrix[1][2] + matrix[0][2]) % 2;
        answer[1][0] = (matrix[0][0] + matrix[1][0] + matrix[2][0] + matrix[1][1]) % 2;
        answer[1][1] = (matrix[1][0] + matrix[1][1] + matrix[1][2] + matrix[1][0] + matrix[2][1]) % 2;
        answer[1][2] = (matrix[0][2] + matrix[1][1] + matrix[2][2] + matrix[1][1]) % 2;
        answer[2][0] = (matrix[2][0] + matrix[1][0] + matrix[2][1]) % 2;
        answer[2][1] = (matrix[2][1] + matrix[1][2] + matrix[2][0] + matrix[2][2]) % 2;
        answer[2][2] = (matrix[2][2] + matrix[2][1] + matrix[1][2]) % 2;
        for (int[] a : answer) {
            for (int b : a)
                out.print(b == 1 ? 0 : 1);
            out.println();
        }
    }

}

class InputReader {

    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        stringTokenizer = null;
    }

    public String next() {
        while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int[][] arr=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                arr[i][j]=sc.nextInt();
                if(arr[i][j]%2!=0)arr[i][j]=1;
                else arr[i][j]=0;
            }
        }
        int[][] res=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                res[i][j]=1;
            }
        }

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(arr[i][j]==1){
                 res[i][j]=(res[i][j]+1)%2;
                 if(i>=1)res[i-1][j]=(res[i-1][j]+1)%2;
                 if(i<2)res[i+1][j]=(res[i+1][j]+1)%2;
                 if(j>=1)res[i][j-1]=(res[i][j-1]+1)%2;
                 if(j<2)res[i][j+1]=(res[i][j+1]+1)%2;
                }
            }
        }
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++)System.out.print(res[i][j]+" ");
            System.out.println();
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class alicebob {

	static String []line1=new String[3];
	static  String []line2=new String[3];;
	static  String []line3=new String[3];;
	static  String result="";

	static  int [][] lights=new int [3][3];

	public static void main(String []args)

	{

	BufferedReader br= new BufferedReader(new InputStreamReader(System.in));

for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
	lights[i][j]=1;

try {

line1=br.readLine().split(" ");
line2=br.readLine().split(" ");
line3=br.readLine().split(" ");

} catch (IOException e) {
	System.out.println("eroor");
	e.printStackTrace();
}

for(int i =0;i<3;i++)
{

for( int j=0;j<Integer.parseInt(line1[i]);j++)
 {
toggle(0, i);
}
}

for(int i =0;i<3;i++)
{

for( int j=0;j<Integer.parseInt(line2[i]);j++)
 {
toggle(1, i);
}
}

for(int i =0;i<3;i++)
{

for( int j=0;j<Integer.parseInt(line3[i]);j++)
 {
toggle(2, i);
}
}

for(int i =0;i<3;i++)
{
	String result="";
for( int j=0;j<3;j++)
 {result+=lights[i][j];

}
System.out.println(result);
}

	}
	public static void reverse(int i, int j)
	{
		if(lights[i][j]==1)
			lights[i][j]=0;
		else
			lights[i][j]=1;
	}
	public static void toggle(int x,int y)
	{
		reverse(x,y);

				if(x==0 )
				{	reverse(x+1,y);

				}
				if(y==0)
				{
					reverse(x,y+1);
				}
				if(x==2)
				{ reverse(x-1,y);
				}
				if( y==2)
				{reverse (x,y-1);}
				if(x!=0 && y!=0 && x!=2 && y!=2)
					{reverse(x-1,y); reverse(x+1,y); reverse(x,y-1);reverse(x,y+1);}

				}

}

import java.util.*;
public class P6 {
    public static void change(int mat[][],int i,int j,int sol[][])
    {
        int ar[][]={{i-1,j},{i,j+1},{i+1,j},{i,j-1}};
        if(sol[i][j]==0)
            sol[i][j]=1;
        else
            sol[i][j]=0;
       for(int k=0;k<4;k++)
       {
           int u=ar[k][0];
           int v=ar[k][1];
           if(u>=0&&u<3&&v>=0&&v<3)
           {
               if(sol[u][v]==1)
                   sol[u][v]=0;
               else
                   sol[u][v]=1;
           }

       }

    }
    public static void main(String[] args)  {
        Scanner sc=new Scanner(System.in);
        int mat[][]=new int[3][3];
        int sol[][]=new int[3][3];
        for(int rows[]:sol)
            Arrays.fill(rows,1);
        int i,j;
        for( i=0;i<3;i++)
        {
            for( j=0;j<3;j++)
            {
                mat[i][j]=sc.nextInt();
            }
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                if(mat[i][j]%2!=0)
                {
                    change(mat,i,j,sol);
                }
            }
        }
        for( i=0;i<3;i++)
        {
            for( j=0;j<3;j++)
            {
                System.out.print(sol[i][j]+" ");
            }
            System.out.println();
        }
    }
}

import java.util.HashSet;
import java.util.Scanner;

public class Main {
    static int[][]res={
            {1 ,1,1},
            {1,1,1},
            {1,1,1} ,
    };

    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int[][]mat=new int[3][3];
      for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
              int c=sc.nextInt();
              mat[i][j]=c;
          }
      }

      for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
               if(mat[i][j]%2==1)
              {
                  func(i,j);
              }
          }
      }

      for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
              System.out.print(res[i][j]+" ");
          }
          System.out.println();
      }

    }

    public static void func(int r,int c){
        res[r][c]^=1;
        if(c+1<3)
         res[r][c+1]^=1;
        if(c-1>=0)
        res[r][c-1]^=1;
        if(r+1<3)
        res[r+1][c]^=1;
        if(r-1>=0)
        res[r-1][c]^=1;

    }
}

import java.util.Scanner;
import java.util.Arrays;
public class LightsOut{
public static int switches[][] = new int[3][3];
public static void main(String []args){
Scanner s = new Scanner(System.in);
for(int[] row : switches)
 Arrays.fill(row, 1);
int i = 0;
int j;
while(i < 3)
{
 j = 0;
while(j < 3){
int r = s.nextInt();
if(r > 0)
 Updategrid(i, j, r);
j++;
}
i++;
}
draw();
}
private static void draw()
{
    int i, j;
    for(i = 0; i < 3; ++i){
         for(j = 0; j< 3; ++j)
          System.out.print(switches[i][j]);
        System.out.println();
    }
    System.out.println();
        }
private static void Updategrid(int i ,int j, int k)
{
int minx = (i - 1) < 0 ? 0 : i - 1;
int maxx = (i + 2) > 2 ? 3: i + 2;
int miny = (j - 1) < 0 ? 0 : j - 1;
int maxy = (j + 2) > 2 ? 3: j + 2;
 for(i = minx;i < maxx;++i)
 {
 for(j = miny; j < maxy;++j){
 if(switches[i][j] == 1 && k % 2 == 1)
   switches[i][j] = 0;
 else if(switches[i][j] == 1 && k % 2 == 0)
     switches[i][j] = 1;
 else if(switches[i][j] == 0 && k % 2 == 0)
  switches[i][j] = 0;
 else if(switches[i][j] == 0 && k % 2 == 1)
     switches[i][j] = 1;
}

}

}
}

import java.util.*;
public class A275
{
    public static void main(String args[])
    {
        Scanner in = new Scanner(System.in);
        int i =0, j=0;
        int a[][]= new int[3][3];
        for( i=0; i<3; i++)
        {
            for( j = 0; j<3; j++)
                a[i][j] = in.nextInt();
        }
        int dx[] = {1, 0, -1, 0};
        int dy[] = {0, 1, 0, -1};
        for( i=0; i<3; i++)
        {
            for( j = 0; j<3; j++)
            {
                int c =a[i][j];
                for(int k =0; k<4; k++)
                {
                    int x = i + dx[k], y = j + dy[k];
                    if(x >= 0 && x < 3 && y >= 0 && y < 3) {
                        c += a[x][y];
                    }
                }
                c--;
                System.out.print(c % 2);
            }
            System.out.println();
        }
    }
}

import java.util.Scanner;

public class lightsOut {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int [][]lights = {{1,1,1},{1,1,1},{1,1,1}};
        int [][]input =new int[3][3];
        for (int i = 0; i<input[0].length; i++){
            for(int j =0; j<input.length; j++){
                input[j][i]=in.nextInt();
            }
        }
        for (int i = 0; i<input[0].length; i++){
            for(int j =0; j<input.length; j++){
                if(input[j][i]%2==1){
                    lights[j][i]=lights[j][i]==1?0:1;
                    if(i<2)
                        lights[j][i+1]=lights[j][i+1]==1?0:1;
                    if(i>0)
                        lights[j][i-1]=lights[j][i-1]==1?0:1;
                    if(j<2)
                        lights[j+1][i]=lights[j+1][i]==1?0:1;
                    if(j>0)
                        lights[j-1][i]=lights[j-1][i]==1?0:1;
                }
            }
            System.out.println();
        }

        for (int i = 0; i<input[0].length; i++){
            for(int j =0; j<input.length; j++){
                System.out.print(lights[j][i]);
            }
            System.out.println();
        }
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

/*
 * @author Mahmoud Aladdin <aladdin3>
 *
 */

public class Main {
    public static void main (String[] args) throws java.lang.Exception {
		InputReader scan = new InputReader(System.in);
		PrintWriter writer = new PrintWriter(System.out, true);
		(new Main(scan, writer)).run();
		writer.close();
    }

    private InputReader jin;
    private PrintWriter jout;

    public Main(InputReader in, PrintWriter out) {
    	this.jin  = in;
    	this.jout = out;
    }

    public void run() throws Exception {
    	int[] dx = new int[]{0, 1, 0, -1, 0};
    	int[] dy = new int[]{0, 0, 1, 0, -1};

    	int[][] arr = new int[5][5];
    	for(int[] row: arr) Arrays.fill(row, 0);
    	for(int i = 1; i <= 3; i++) {
    		for(int j = 1; j <= 3; j++) {
				int t = jin.integer();
				for(int k = 0; k < dx.length; k++) {
					arr[i + dx[k]][j + dy[k]]++;
				}
    		}
    	}
    	for(int i = 1; i <= 3; i++) {
    		for(int j = 1; j <= 3; j++) {
				jout.print(arr[i][j] % 2 == 0? "1" : "0");
    		}
    		jout.println();
    	}
    }
}

class InputReader {
    private static final int bufferMaxLength = 1024;
    private InputStream in;
    private byte[] buffer;
    private int currentBufferSize;
    private int currentBufferTop;
    private static final String tokenizers = " \t\r\f\n";

    public InputReader(InputStream stream) {
        this.in = stream;
        buffer = new byte[bufferMaxLength];
        currentBufferSize = 0;
        currentBufferTop = 0;
    }

    private boolean refill() throws IOException {
        this.currentBufferSize = this.in.read(this.buffer);
        this.currentBufferTop = 0;
        return this.currentBufferSize > 0;
    }

    private Byte readChar() throws IOException {
        if(currentBufferTop < currentBufferSize) {
            return this.buffer[this.currentBufferTop++];
        } else {
            if(!this.refill()) {
                return null;
            } else {
                return readChar();
            }
        }
    }

    public String token() throws IOException {
        StringBuffer tok = new StringBuffer();
        Byte first;
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));
        if(first == null) return null;
        tok.append((char)first.byteValue());
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {
            tok.append((char)first.byteValue());
        }
        return tok.toString();
    }

    public String line() throws IOException {
		Byte first;
		StringBuffer line = new StringBuffer();
		while ((first = readChar()) != null && (char)first.byteValue() != '\n') {
			line.append((char)first.byteValue());
		}
		return (first == null && line.length() == 0)? null : line.toString();
    }

    public Integer integer() throws NumberFormatException, IOException {
        String tok = token();
        return tok == null? null : Integer.parseInt(tok);
    }

}

import java.util.*;
public class Lights_Out
{
   public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int[][] lights = new int[3][3];
        //defining 2D array to hold matrix data
        int[][] matrix = new int[3][3];
        // Enter Matrix Data
        enterMatrixData(scan, matrix,lights);
        func(matrix,lights);
}
public static void enterMatrixData(Scanner scan, int[][] matrix,int[][] lights){
          for (int i = 0; i < 3; i++)
          {
              for (int j = 0; j < 3; j++)
              {
                  matrix[i][j] = scan.nextInt();
                  lights[i][j]=1;
              }
          }
  }
public static void func(int[][] matrix,int[][] lights){
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if(matrix[i][j]%2!=0)
                {
                    if(lights[i][j]==1)
                    lights[i][j]=0;
                    else
                    lights[i][j]=1;
                    if(i+1==1||i+1==2)
                    {
                        if(lights[i+1][j]==1)
                          lights[i+1][j]=0;
                        else
                           lights[i+1][j]=1;
                    }
                    if(i-1==0||i-1==1)
                    {
                        if(lights[i-1][j]==1)
                          lights[i-1][j]=0;
                        else
                           lights[i-1][j]=1;
                    }
                    if(j+1==1||j+1==2)
                    {
                        if(lights[i][j+1]==1)
                          lights[i][j+1]=0;
                        else
                           lights[i][j+1]=1;
                    }
                    if(j-1==1||j-1==0)
                    {
                        if(lights[i][j-1]==1)
                          lights[i][j-1]=0;
                        else
                           lights[i][j-1]=1;
                    }
                }
            }
        }
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                System.out.println(lights[i][j]);
            }
        }
  }
}

import java.util.Scanner;

public class ALightsOut {

    public boolean[][] toggle(int[][] lights) {
        boolean[][] result = new boolean[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int n = lights[i][j];
                if (n % 2 == 1) {
                    result[i][j] ^= true;
                    if (i > 1) result[i - 1][j] ^= true;
                    if (i < 2) result[i + 1][j] ^= true;
                    if (j > 1) result[i][j - 1] ^= true;
                    if (j < 2) result[i][j + 1] ^= true;
                }
            }
        }
        return result;
    }

    public static void main(String[] args) {

        int[][] lights = new int[3][3];

        Scanner input = new Scanner(System.in);
        try {
            for (int i = 0; i < 3; i++) {
                String line = input.nextLine();
                String[] row = line.split(" ");
                for (int j = 0; j < 3; j++) {
                    lights[i][j] = Integer.parseInt(row[j]);
                }
            }
            boolean[][] result = new ALightsOut().toggle(lights);
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    System.out.print(result[i][j] ? 0 : 1);
                }
                System.out.println();
            }
        } finally {
            input.close();
        }
    }
}

import java.io.*;
import java.util.*;

public class Solution{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	Scanner in=new Scanner(System.in);
	boolean isValid(int i,int j){
		return i>=0&&i<3&&j>=0&&j<3;
	}
	void toggle(int[][] res,int i,int j){
		res[i][j]=(res[i][j]==0?1:0);
	}

	public void solve(){
		int[][] arr=new int[3][3];
		int[][] res=new int[3][3];
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				arr[i][j]=ni();
				res[i][j]=1;
			}
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(arr[i][j]%2!=0){
					if(isValid(i,j))
						toggle(res,i,j);
					if(isValid(i+1,j+1))
						toggle(res,i+1,j+1);
					if(isValid(i+1,j))
						toggle(res,i+1,j);
					if(isValid(i+1,j-1))
						toggle(res,i+1,j-1);
					if(isValid(i,j+1))
						toggle(res,i,j+1);
					if(isValid(i,j-1))
						toggle(res,i,j-1);
					if(isValid(i-1,j))
						toggle(res,i-1,j);
					if(isValid(i-1,j+1))
						toggle(res,i-1,j+1);
					if(isValid(i-1,j-1))
						toggle(res,i-1,j-1);
				}
			}
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				out.print(res[i][j]+" ");
			}
			out.println();
		}
	}
	void run(){
		is = new DataInputStream(System.in);
		out = new PrintWriter(System.out);
		int t=1;while(t-->0)solve();
		out.flush();
	}
	public static void main(String[] args)throws Exception{new Solution().run();}
	//Fast I/O code is copied from uwi code.
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	private int readByte(){
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	private String ns(){
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	private char[] ns(int n){
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	private char[][] nm(int n, int m){
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	private int[] na(int n){
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	private int ni(){
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	private long nl(){
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	static  int i(long x){return (int)Math.round(x);}
	static int i(double x){return (int)Math.round(x);}
	static class Pair implements Comparable<Pair>{
		long fs,sc;
		Pair(long a,long b){
			fs=a;sc=b;
		}
		public int compareTo(Pair p){
			if(this.fs>p.fs)return 1;
			else if(this.fs<p.fs)return -1;
			else{
				return i(this.sc-p.sc);
			}
			//return i(this.sc-p.sc);
		}
		public String toString(){
			return "("+fs+","+sc+")";
		}
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int stat[][]=new int[3][3];

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++)
                stat[i][j]=1;
        }

        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++){
                int num=in.nextInt();
                for(int k=0;k<num;k++){
                    toggle(stat,i,j);
                    if((i-1)>0)
                        toggle(stat,i-1,j);
                    if((j-1)>0)
                        toggle(stat,i,j-1);
                    if((i+1)<3)
                        toggle(stat,i+1,j);
                    if((j+1)<3)
                        toggle(stat,i,j+1);
                }
            }

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                out.print(stat[i][j]+" ");
            }
            out.print("\n");
        }

        out.close();
    }

    static void toggle(int arr[][],int i,int j){
        if(arr[i][j]==0)
            arr[i][j]=1;
        else
            arr[i][j]=0;
    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.awt.datatransfer.StringSelection;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;

public class A {
    static Scanner in; static int next() throws Exception {return in.nextInt();};
    //	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
//	static BufferedReader in;
    static PrintWriter out;

    static void add(int a[][], int r, int c, int val) {
        if (r < 3&&r >= 0&&c < 3&&c >= 0) a[r][c] += val;
    }
    public static void main(String[] args) throws Exception {
        in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        int a[][] = new int[3][3];
        for (int i = 0;i < 3;i++) {
            for (int j = 0;j < 3;j++) {
                int c = next();
                a[i][j] += c;
                add(a,i-1,j,c);
                add(a,i+1,j,c);
                add(a,i,j-1,c);
                add(a,i,j+1,c);
            }
        }

        for (int i = 0;i < 3;i++) {
            for (int j = 0;j < 3;j++) out.print((a[i][j]+1)%2 + " ");
            out.println();
        }

        out.println();
        out.close();
    }
}

import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Short.parseShort;
import static java.lang.Byte.parseByte;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2 {
    static boolean x;
    static int nextInt() throws IOException {
        return parseInt(next());
    }

    static long nextLong() throws IOException {
        return parseLong(next());
    }

    static short nextShort() throws IOException {
        return parseShort(next());
    }

    static byte nextByte() throws IOException {
        return parseByte(next());
    }

    static String next() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String args[]) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    static void solve() throws IOException {
        int[][] lights = new int[3][3];
        boolean[][]light=new boolean[3][3];
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++) {
                lights[i][j] = nextInt();
                light[i][j]=true;
            }
        for (int i = 0; i <3 ; i++)
            for (int j = 0; j < 3; j++)
                for (int k = 1; k <=lights[i][j] ; k++) {
                    light[i][j]=!light[i][j];
                    light[i][j==2?j:j+1]=!light[i][j==2?j:j+1];
                    light[i][j==0?j:j-1]=!light[i][j==0?j:j-1];
                    light[i==2?i:i+1][j]=!light[i==2?i:i+1][j];
                    light[i==0?i:i-1][j]=!light[i==0?i:i-1][j];
                }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++)
                if (light[i][j])
                    out.print(1);
                else
                    out.print(0);
            out.println();
        }
    }
}

import java.util.*;

import java.lang.*;
import java.io.*;
public class MAIN {

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	 static long gcd(long a, long b)
	    {
	        if (b == 0)
	            return a;
	        return gcd(b , a%b);
	    }

	    // Function to find gcd of array of
	    // numbers
	    static long findGCD(long arr[], int l,int r)
	    {
	        long result = arr[r];
	        for (int i = l; i <r; i++)
	            result = gcd(arr[i], result);

	        return result;
	    }

	public static void main(String[] args){
		// TODO Auto-generated method
		OutputStream outputStream = System.out;
        FastReader scn = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);

        //int n= scn.nextInt();

        boolean[][] mat = new boolean[3][3];

        for(int i=0;i<3;i++)
        {
        	 Arrays.fill(mat[i], true);

        }
        int ma[][] = new int[3][3];
        for(int i=0;i<3;i++)
        {

        	for(int j=0;j<3;j++)
        	{
        		ma[i][j]=scn.nextInt()%2;
        	}
        }

        for(int i=0;i<2;i++)
        {
        	for(int j =0;j<2;j++)
        	{
        		if(ma[i][j]==1)
        		{
        			mat[i][j]=!mat[i][j];
        			mat[i][j+1]=!mat[i][j+1];
        			mat[i+1][j]=!mat[i+1][j];

        		}
        	}
        }

        for(int i=1;i<3;i++)
        {
        	for(int j =1;j<3;j++)
        	{
        		if(ma[i][j]==1)
        		{
        			mat[i][j]=!mat[i][j];
        			mat[i][j-1]=!mat[i][j-1];
        			mat[i-1][j]=!mat[i-1][j];

        		}
        	}
        }
        if(ma[1][1]==1)
        mat[1][1]=!mat[1][1];
       if(ma[2][0]==1)
        {
    	   mat[2][0]=!mat[2][0];
    	   mat[1][0]=!mat[1][0];
    	   mat[2][1]=!mat[2][1];

        }
       if(ma[0][2]==1)
       {
   	   mat[0][2]=!mat[0][2];
   	   mat[0][1]=!mat[0][1];
   	   mat[1][2]=!mat[1][2];

       }

       for(int i=0;i<3;i++)
       {
       	for(int j =0;j<3;j++)
       	{

       			out.print(mat[i][j]==true?1:0);

       	}
       	out.println();
       }

       out.close();

	}

	static boolean isDistinct(int year)
	{
		HashSet<Integer> h = new HashSet<>();

		while(year>0)
		{
			h.add(year%10);
			year=year/10;

		}

		if(h.size()==4) return true;

		return false;

	}

	/*static class comp implements Comparator<Pair>
	{

		@Override
		public int compare(Pair arg0, Pair arg1) {
			// TODO Auto-generated method stub
			if(arg0.b<arg1.b) return 1;
			if(arg0.b>arg1.b) return -1;
			if(arg0.b==arg1.b)
				if(arg0.a<arg1.a) return 1;
				else
					return -1;

			return 0;
		}

	}*/
	static class Pair
	{
	    int a;
	    int b;
	}
	static class Compare
	{
		static void compare(Pair ar[])
		{
			Arrays.sort(ar, new Comparator<Pair>(){
				@Override
				public int compare(Pair arg0, Pair arg1) {
					// TODO Auto-generated method stub
					if(arg0.b<arg1.b) return 1;
					if(arg0.b>arg1.b) return -1;
					if(arg0.b==arg1.b)
						if(arg0.a<arg1.a) return -1;
						else
							return 1;

					return 0;
				}
			});
		}
	}
	public static int[] radixSort(int[] f){ return radixSort(f, f.length); }

	public static int[] radixSort(int[] f, int n)
	{
		int[] to = new int[n];
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]&0xffff)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]&0xffff]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		{
			int[] b = new int[65537];
			for(int i = 0;i < n;i++)b[1+(f[i]>>>16)]++;
			for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
			for(int i = 0;i < n;i++)to[b[f[i]>>>16]++] = f[i];
			int[] d = f; f = to;to = d;
		}
		return f;
	}

}

import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author mahaalarifi
 */
public class Solution {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String txt = input.nextLine()+input.nextLine()+input.nextLine();
        int index=0;
        char[] arr = txt.replaceAll(" ", "").toCharArray();
        boolean[][] light = new boolean[3][3];
        System.out.println(arr[0] + " " + arr[1] + " " + arr[2]);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (arr[index] % 2 != 0) {
                    light[i][j] = !light[i][j];
                    if (i < 2) {
                        light[i + 1][j] = !light[i + 1][j];
                    }
                    if (i > 0) {
                        light[i - 1][j] = !light[i - 1][j];
                    }
                    if (j < 2) {
                        light[i][j + 1] = !light[i][j + 1];
                    }
                    if (j > 0) {
                        light[i][j - 1] = !light[i][j - 1];
                    }
                }
                index++;
            }
        }
        String answer;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                answer= light[i][j] ? "0" : "1";
                System.out.print(answer);
            }
            System.out.println("");
        }
    }

}

import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class CodeChef {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int m[][]=new int[3][3];
        int tmp[][]=new int[3][3];
        for (int i=0;i<3;i++)
                    for (int j=0;j<3;j++)
                        tmp[i][j]=scan.nextInt();
        for (int i=0;i<3;i++){
            for (int j=0;j<3;j++)
            {
                 for (int z=0;z<tmp[i][j];z++)
                {
                m[i][j]^=1;
              if (j-1>=0 && j-1<3)
                  m[i][j-1]^=1;
              if (j+1>=0 && j+1<3)
                  m[i][j+1]^=1;
              if (i-1>0 && i-1<3)
                  m[i-1][j]^=1;
              if (i+1>=0 && i+1<3)
                 m[i+1][j]^=1;
                }
                }
                }

                for (int i=0;i<3;i++){
                    for (int j=0;j<3;j++)
                        System.out.print(m[i][j]^1);
                    System.out.println();
                }
    }
}

import java.util.Scanner;
public class A275{
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int[][] matrix = new int[3][3];
        int[][] new_matrix = new int[3][3];
        for(int i=0;i<3;i++){
            for(int x=0;x<3;x++){
                matrix[i][x] = input.nextInt();
            }
        }
        new_matrix[0][0]=matrix[0][0]+matrix[0][1]+matrix[1][0];
        new_matrix[0][1]=matrix[0][0]+matrix[0][1]+matrix[0][2]+matrix[1][1];
        new_matrix[0][2]=matrix[0][1]+matrix[0][2]+matrix[1][2];
        new_matrix[1][0]=matrix[1][0]+matrix[0][0]+matrix[1][2]+matrix[2][0];
        new_matrix[1][1]=matrix[0][1]+matrix[1][1]+matrix[1][0]+matrix[1][2]+matrix[2][0];
        new_matrix[1][2]=matrix[0][2]+matrix[1][2]+matrix[1][1]+matrix[2][2];
        new_matrix[2][0]=matrix[2][0]+matrix[1][0]+matrix[2][1];
        new_matrix[2][1]=matrix[2][0]+matrix[2][1]+matrix[2][2]+matrix[1][1];
        new_matrix[2][2]=matrix[2][2]+matrix[2][1]+matrix[1][2];
        for(int i=0;i<3;i++){
            for(int x=0;x<3;x++){
                if(new_matrix[i][x]%2 == 0){
                    matrix[i][x]=1;
                }else{
                    matrix[i][x]=0;
                }
            }
        }
        for(int i=0;i<3;i++){
            for(int x=0;x<3;x++){
                System.out.print(matrix[i][x]);
            }
            System.out.println();
        }
    }
}

import java.io.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class CF275A {
    static BufferedReader __in;
    static PrintWriter __out;
    static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        __in = new BufferedReader(new InputStreamReader(System.in));
        __out = new PrintWriter(new OutputStreamWriter(System.out));
        int[][] a = new int[3][3];
        for(int i = 0; i < 3; ++i) {
            String[] c = rline().split(" ");
            System.out.println(Arrays.toString(c));
            for(int cc = 0; cc < 3; ++cc) {
                a[i][cc] = Integer.parseInt(c[cc]);
            }
        }
        int[][] b = new int[3][3];
        b[0][0] = (a[0][0] + a[0][1] + a[1][0] + 1) % 2;
        b[0][1] = (a[0][0] + a[0][1] + a[0][2] + a[1][1] + 1) % 2;
        b[0][2] = (a[0][1] + a[0][2] + a[1][2] + 1) % 2;
        b[1][0] = (a[0][0] + a[1][0] + a[2][0] + a[1][1] + 1) % 2;
        b[1][1] = (a[0][1] + a[1][0] + a[2][1] + a[1][2] + a[1][1]+ 1) % 2;
        b[1][2] = (a[0][2] + a[1][2] + a[1][1] + a[2][2] + 1) % 2;
        b[2][0] = (a[1][0] + a[2][0] + a[0][1] + 1) % 2;
        b[2][1] = (a[1][1] + a[2][0] + a[2][1] + a[2][2] + 1) % 2;
        b[2][2] = (a[1][2] + a[2][1] + a[2][2] + 1) % 2;

        for(int i = 0; i < 3; ++i) {
            for(int x : b[i]) pr(x);
            prln();
        }

        close();
    }

    // references
    // IBIG = 1e9 + 7
    // IRAND ~= 3e8
    // IMAX ~= 2e10
    // LMAX ~= 9e18
    // constants
    static final int IBIG = 1000000007;
    static final int IRAND = 327859546;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;
    // util
    static int minof(int a, int b, int c) {return min(a, min(b, c));}
    static int minof(int... x) {return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));}
    static int minstarting(int offset, int... x) {assert x.length > 2; return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));}
    static long minof(long a, long b, long c) {return min(a, min(b, c));}
    static long minof(long... x) {return x.length == 1 ? x[0] : x.length == 2 ? min(x[0], x[1]) : min(x[0], minstarting(1, x));}
    static long minstarting(int offset, long... x) {assert x.length > 2; return offset == x.length - 2 ? min(x[offset], x[offset + 1]) : min(x[offset], minstarting(offset + 1, x));}
    static int maxof(int a, int b, int c) {return max(a, max(b, c));}
    static int maxof(int... x) {return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));}
    static int maxstarting(int offset, int... x) {assert x.length > 2; return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));}
    static long maxof(long a, long b, long c) {return max(a, max(b, c));}
    static long maxof(long... x) {return x.length == 1 ? x[0] : x.length == 2 ? max(x[0], x[1]) : max(x[0], maxstarting(1, x));}
    static long maxstarting(int offset, long... x) {assert x.length > 2; return offset == x.length - 2 ? max(x[offset], x[offset + 1]) : max(x[offset], maxstarting(offset + 1, x));}
    static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static int floori(double d) {return (int)d;}
    static int ceili(double d) {return (int)ceil(d);}
    static long floorl(double d) {return (long)d;}
    static long ceill(double d) {return (long)ceil(d);}
    // input
    static void r() throws IOException {input = new StringTokenizer(__in.readLine());}
    static int ri() throws IOException {return Integer.parseInt(__in.readLine());}
    static long rl() throws IOException {return Long.parseLong(__in.readLine());}
    static int[] ria(int n) throws IOException {int[] a = new int[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Integer.parseInt(input.nextToken()); return a;}
    static long[] rla(int n) throws IOException {long[] a = new long[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Long.parseLong(input.nextToken()); return a;}
    static char[] rcha() throws IOException {return __in.readLine().toCharArray();}
    static String rline() throws IOException {return __in.readLine();}
    static int rni() throws IOException {input = new StringTokenizer(__in.readLine()); return Integer.parseInt(input.nextToken());}
    static int ni() {return Integer.parseInt(input.nextToken());}
    static long rnl() throws IOException {input = new StringTokenizer(__in.readLine()); return Long.parseLong(input.nextToken());}
    static long nl() {return Long.parseLong(input.nextToken());}
    // output
    static void pr(int i) {__out.print(i);}
    static void prln(int i) {__out.println(i);}
    static void pr(long l) {__out.print(l);}
    static void prln(long l) {__out.println(l);}
    static void pr(double d) {__out.print(d);}
    static void prln(double d) {__out.println(d);}
    static void pr(char c) {__out.print(c);}
    static void prln(char c) {__out.println(c);}
    static void pr(char[] s) {__out.print(new String(s));}
    static void prln(char[] s) {__out.println(new String(s));}
    static void pr(String s) {__out.print(s);}
    static void prln(String s) {__out.println(s);}
    static void pr(Object o) {__out.print(o);}
    static void prln(Object o) {__out.println(o);}
    static void prln() {__out.println();}
    static void pryes() {__out.println("yes");}
    static void pry() {__out.println("Yes");}
    static void prY() {__out.println("YES");}
    static void prno() {__out.println("no");}
    static void prn() {__out.println("No");}
    static void prN() {__out.println("NO");}
    static void pryesno(boolean b) {__out.println(b ? "yes" : "no");};
    static void pryn(boolean b) {__out.println(b ? "Yes" : "No");}
    static void prYN(boolean b) {__out.println(b ? "YES" : "NO");}
    static void prln(int... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static void prln(long... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for(int i = 0; i < n; __out.print(iter.next()), __out.print(' '), ++i); __out.println(iter.next());}
    static void flush() {__out.flush();}
    static void close() {__out.close();}}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
	public static void main(String[] args) throws IOException
	{	int xA []={0, 1, 1, 0,-1,-1,-1, 0, 1};
		int yA []={0, 0, 1, 1, 1, 0,-1,-1,-1};
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		int in [][] = new int [3][3];int outp [][]= new int [3][3];
		for(int i=0;i<3;i++)
		{	String line []=br.readLine().split(" ");
			for(int j=0;j<3;j++)
			{
				in[i][j]=Integer.parseInt(line[j]);
				outp[i][j]=1;
			}

		}

		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
			{
				if(in[i][j]%2!=0)
				{
					for(int k=0;k<8;k++)
					{
						int x =xA[k]+j;
						int y =yA[k]+i;
						if(x<0||x>2)
							continue;
						if(y<0||y>2)
							continue;
						outp[y][x]=1-outp[y][x];
					}
				}
			}
		StringBuilder sb = new StringBuilder("");
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{

				sb.append(outp[i][j]);
			}
			sb.append("\n");

		}
		System.out.println(sb.toString());
	}
}

import java.util.Scanner;

public class Solution {

	private static boolean[][] state;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int[][] input = new int[3][3];
		state = new boolean[3][3];
		for(int i=0;i<9;i++){
			int j = sc.nextInt();
			if(j%2==1){
				changeState(i);
			}
		}

		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(state[i][j]){
					System.out.print("0 ");
				}else{
					System.out.print("1 ");
				}
			}
			System.out.println("");
		}

	}

	private static void changeState(int i) {
		int x = i/3;
		int y = i%3;
		state[x][y] = !state[x][y];
		if(x>0){
			state[x-1][y] = !state[x-1][y];
		}
		if(x<2){
			state[x+1][y] = !state[x+1][y];
		}
		if(y>0){
			state[x][y-1] = !state[x][y-1];
		}
		if(y<2){
			state[x][y+1] = !state[x][y+1];
		}

	}

}

import java.util.Scanner ;
public class Demo {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        boolean Lights [][] = { {true,true,true} , {true,true,true} , {true,true,true} } ;
        int x = 0 ;
        for( int i = 0 ; i < 3 ; i++)
        {
            for (int j = 0 ; j < 3 ; j++)
            {
                x = input.nextInt();
                if( x % 2 == 1)
                {
                    Lights[i][j] = !Lights[i][j];
                    if( 0  <=  i+1  && i+1 <= 2)
                    {
                        Lights[i+1][j] = !Lights[i+1][j];
                    }
                    if( 0  <=  i-1  && i-1 <= 2)
                    {
                        Lights[i-1][j] = !Lights[i-1][j];
                    }
                    if( 0  <=  j+1  && j+1 <= 2)
                    {
                        Lights[i][j+1] = !Lights[i][j+1];
                    }
                    if( 0  <= j-1  && j-1 <= 2)
                    {
                        Lights[i][j-1] = !Lights[i][j-1];
                    }

                }
            }
        }
        for( int i = 0 ; i < 3 ; i++) {
            for (int j = 0; j < 3; j++) {
                if( j == 2)
                    System.out.println(Lights[i][j]);
                else
                    System.out.print(Lights[i][j]);

            }
        }
    }
}

import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		Scanner r = new Scanner(System.in);
		int i=0, j=0, k=0;
		boolean[][] l = new boolean[][]{{true,true,true},
				{true,true,true},
				{true,true,true}
		};

		for(i=0; i<3; i++){
			for(j=0; j<3; j++){
				k = r.nextInt();
				if(k%2!=0){
					l[i][j] = !l[i][j];
					if(i+1<3){
						l[i+1][j] = !l[i+1][j];
					}
					if(i-1>0){
						l[i-1][j] = !l[i-1][j];
					}
					if(j+1<3){
						l[i][j+1] = !l[i][j+1];
					}
					if(j-1>0){
						l[i][j-1] = !l[i][j-1];
					}
				}
			}

		}

		for(i=0; i<3; i++){
			for(j=0; j<3; j++){
				if(l[i][j]){
					System.out.print("1");
				}else{
					System.out.print("0");
				}
			}
			System.out.print("\n");
		}
	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author vadimmm
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int[][] matrix = new int[3][3];
        for (int i = 0; i < 3; ++i)
            for (int j = 0; j < 3; ++j)
                matrix[i][j] = in.nextInt();
        int[][] answer = new int[3][3];
        answer[0][0] = (1 + matrix[0][0] + matrix[1][0] + matrix[0][1]) % 2;
        answer[0][1] = (1 + matrix[0][0] + matrix[0][1]  + matrix[0][2] + matrix[1][1]) % 2;
        answer[0][2] = (1 + matrix[0][1] + matrix[1][2] + matrix[0][2]) % 2;
        answer[1][0] = (1 + matrix[0][0] + matrix[1][0] + matrix[2][0] + matrix[1][1]) % 2;
        answer[1][1] = (1 + matrix[1][0] + matrix[1][1] + matrix[1][2] + matrix[1][0] + matrix[2][1]) % 2;
        answer[1][2] = (1 + matrix[0][2] + matrix[1][1] + matrix[2][2] + matrix[1][2]) % 2;
        answer[2][0] = (1 + matrix[2][0] + matrix[1][0] + matrix[2][1]) % 2;
        answer[2][1] = (1 + matrix[2][1] + matrix[1][1] + matrix[2][0] + matrix[2][2]) % 2;
        answer[2][2] = (1 + matrix[2][2] + matrix[2][1] + matrix[1][2]) % 2;
        for (int[] a : answer) {
            for (int b : a)
                out.print(b);
            out.println();
        }
    }

}

class InputReader {

    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        stringTokenizer = null;
    }

    public String next() {
        while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    }

// Working program with FastReader
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Main
{
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

    static void toggle(int i, int j, int x[][], int n)
    {
        if(n==0)
        return;
        else
        {
            int mod=x[i][j];
            for(int m=0;m<3;m++)
            {
                mod = x[i][m];
                x[i][m]=1-mod;
            }
            for(int m=0;m<3;m++)
            {
                mod = x[m][j];
                if(m!=i)
                x[m][j]=1-mod;
            }
            toggle(i,j,x,n-1);
        }
    }
	public static void main(String[] args)
	{
		FastReader s=new FastReader();
		int x[][]=new int[3][3];
		int y[][]=new int[3][3];

		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        x[i][j]=1;
		         y[i][j]=s.nextInt();
		    }
		}

    	for(int i=0;i<3;i++)
    	{
    	    for(int j=0;j<3;j++)
    	    {
    	        toggle(i,j,x,y[i][j]);
    	    }
    	}

	}
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s[][] = { { 1, 1, 1, }, { 1, 1, 1, }, { 1, 1, 1, } };
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				int x = in.nextInt();
				switchTo(s, i, j, x);
			}
		}
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < s.length; j++)
				System.out.print(s[i][j]);
			System.out.println();
		}
	}

	private static void switchTo(int[][] s, int i, int j, int x) {
		for (int k = 0; k < x; k++) {

			s[i][j] = 1 - s[i][j];

			if (i + 1 < s.length)
				s[i + 1][j] = 1 - s[i + 1][j];

			if (j + 1 < s[i].length)
				s[i][j + 1] = 1 - s[i][j + 1];

			if (i + 1 < s.length && j + 1 < s[i].length)
				s[i + 1][j + 1] = 1 - s[i + 1][j + 1];

			if (i - 1 >= 0)
				s[i - 1][j] = 1 - s[i - 1][j];

			if (j - 1 >= 0)
				s[i][j - 1] = 1 - s[i][j - 1];

			if (i - 1 >= 0 && j - 1 >= 0)
				s[i - 1][j - 1] = 1 - s[i - 1][j - 1];
		}

	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;

public class Main {
public static void main(String s[]) {
	InputStream inputStream = System.in;
	OutputStream outputStream = System.out;
	InputReader in = new InputReader(inputStream);
	OutputWriter out = new OutputWriter(outputStream);

	int a[][]=new int[3][3];
	int b[][]=new int[3][3];
	for(int I=0;I<=2;I++){
		for(int J=0;J<=2;J++){
			a[I][J]=in.readInt();
		}
	}
		for(int I=0;I<=2;I++){
			for(int J=0;J<=2;J++){
				if(I==0&&J==0){
					b[I][J]=(a[I][J]+a[I+1][J]+a[I][J+1]+1)%2;
				}else if(I==2&&J==2){
					b[I][J]=(a[I-1][J]+a[I][J-1]+a[I][J]+1)%2;
				}else if(I==0&&J==1){
					b[0][1]=(a[0][0]+a[0][1]+a[1][1]+a[0][2]+1)%2;
				}else if(I==0&&J==2){
					b[0][2]=(a[0][1]+a[1][2]+a[0][2]+1)%2;
				}else if(I==1&&J==0){
					b[1][0]=(a[1][0]+a[0][0]+a[2][0]+a[1][1]+1)%2;
				}else if(I==1&&J==1){
					b[1][1]=(a[1][1]+a[0][1]+a[2][1]+a[1][2]+a[1][0]+1)%2;
				}else if(I==1&&J==2){
					b[1][2]=(a[1][2]+a[0][2]+a[2][2]+a[1][1]+1)%2;
				}else if(I==2&&J==0){
					b[2][0]=(a[2][0]+a[1][0]+a[2][1]+1)%2;
				}else if(I==2&&J==1){
					b[2][1]=(a[2][1]+a[2][0]+a[2][2]+a[1][1]+1)%2;
				}

			}
		}
		for(int I=0;I<=2;I++){
			for(int J=0;J<=2;J++){
				out.print(b[I][J]+" ");
			}out.printLine();
		}

out.close();}
}
class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

import java.util.Scanner;

public class Panoramix {

	public static void main(String[] args)
	{
		int [][] light = new int [3][3];
		int [][] input = new int [3][3];
		Scanner in = new Scanner(System.in);

		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				light[i][j] = 1;
			}
		}

		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				input[i][j] = in.nextInt();
			}
		}
		in.close();

		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				if(input[i][j]%2!=0)
				{
					if(light[i][j]==1)
					{
						light[i][j]=0;
					}
					else
					{
						light[i][j]=1;
					}
					if(i==0)
					{
						if(light[i+1][j]==1)
						{
							light[i+1][j]=0;
						}
						else
						{
							light[i+1][j]=1;

						}

						if(j==0 )
						{
							if(light[i][j+1]==1)
							{
								light[i][j+1]=0;
							}
							else
							{
								light[i][j+1]=1;

							}
						}
						else if(j==2)
						{
							if(light[i][j-1]==1)
							{
								light[i][j-1]=0;
							}
							else
							{
								light[i][j-1]=1;

							}
						}
						else
						{
							System.out.println(i+" "+j);
							if(light[i][j-1]== 1)
							{
								System.out.println(i+" "+j);
								light[i][j-1]=0;
							}
							else
							{
								light[i][j-1]=1;

							}
							if(light[i][j+1]==1)
							{
								light[i][j+1]=0;
							}
							else
							{
								light[i][j+1]=1;

							}
						}

					}
					else if(i==2)
					{
						if(light[i-1][j]==1)
						{
							light[i-1][j]=0;
						}
						else
						{
							light[i-1][j]=1;

						}

						if(j==0)
						{
							if(light[i][j+1]==1)
							{
								light[i][j+1]=0;
							}
							else
							{
								light[i][j+1]=1;

							}
						}
						else if(j==2)
						{
							if(light[i][j-1]==1)
							{
								light[i][j-1]=0;
							}
							else
							{
								light[i][j-1]=1;

							}
						}
						else
						{
							if(light[i][j-1]==1)
							{
								light[i][j-1]=0;
							}
							else
							{
								light[i][j-1]=1;

							}
							if(light[i][j+1]==1)
							{
								light[i][j+1]=0;
							}
							else
							{
								light[i][j+1]=1;

							}
						}

				}
					else
					{
						if(light[i][j-1]==1)
						{
							light[i][j-1]=0;
						}
						else
						{
							light[i][j-1]=1;

						}

						if(light[i][j+1]==1)
						{
							light[i][j+1]=0;
						}
						else
						{
							light[i][j+1]=1;

						}
						if(light[i-1][j]==1)
						{
							light[i-1][j]=0;
						}
						else
						{
							light[i-1][j]=1;

						}
						if(light[i+1][j]==1)
						{
							light[i+1][j]=0;
						}
						else
						{
							light[i+1][j]=1;

						}

					}

			}
			}
		}
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				System.out.print(light[i][j]+" ");
			}
			System.out.println();
		}

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tushar Paliwal
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ALightsOut solver = new ALightsOut();
        solver.solve(1, in, out);
        out.close();
    }

    static class ALightsOut {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            boolean lights[][] = new boolean[3][3];
            for (int i = 0; i < 3; i++) {
                Arrays.fill(lights[i], true);
            }

            int toggle;
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    toggle = in.nextInt();
                    if (i == 0) {
                        if (j == 0) {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j + 1);
                            toggleLight(lights, toggle, i + 1, j);
                        } else if (j == 2) {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j - 1);
                            toggleLight(lights, toggle, i + 1, j);
                        } else {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j + 1);
                            toggleLight(lights, toggle, i, j - 1);
                            toggleLight(lights, toggle, i + 1, j);
                        }
                    } else if (i == 2) {
                        if (j == 0) {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j + 1);
                            toggleLight(lights, toggle, i - 1, j);
                        } else if (j == 2) {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j - 1);
                            toggleLight(lights, toggle, i - 1, j);
                        } else {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j + 1);
                            toggleLight(lights, toggle, i, j - 1);
                            toggleLight(lights, toggle, i - 1, j);
                        }
                    } else {
                        if (j == 0) {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j + 1);
                            toggleLight(lights, toggle, i - 1, j);
                        } else if (j == 2) {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i - 1, j);
                            toggleLight(lights, toggle, i - 1, j);
                        } else {
                            toggleLight(lights, toggle, i, j);
                            toggleLight(lights, toggle, i, j + 1);
                            toggleLight(lights, toggle, i + 1, j);
                            toggleLight(lights, toggle, i - 1, j);
                        }
                    }
                }
            }

            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++)
                    out.print(lights[i][j] ? 1 : 0);
                out.println();
            }

        }

        void toggleLight(boolean lights[][], int toggle, int i, int j) {
            if (toggle != 0 && toggle % 2 != 0) {
                lights[i][j] = !lights[i][j];
            }
        }

    }
}

import java.io.Writer;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.math.*;

public class A275{
  static class ProblemSolver{
    static int[][] changeState(int s[][], int i, int j, int k){
      try{
        s[i-1][j]^=k;
      }
      catch(Exception e){ }
      try{
        s[i+1][j]^=k;
      }
      catch(Exception e){ }
      try{
        s[i][j-1]^=k;
      }
      catch(Exception e){ }
      try{
        s[i][j+1]^=k;
      }
      catch(Exception e){ }
      return s;
    }
    public void solveTheProblem(InputReader in,OutputWriter out, NumberTheory nt){
      int test=1;//in.nextInt();
      while(test-- >0){
        int ar[][]= new int[3][3];
        ar=in.nextIntMatrix(3, 3);
        int s[][]= new int[3][3];
        for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
            s[i][j]=1;
          }
        }
        for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
            if(ar[i][j]%2==1){
              s[i][j]=0;
              s=changeState(s, i, j, 1);
            }
          }
        }
        out.print(s);
      }
    }
  }

  public static void main(String[] args){
    InputStream inputStream=System.in;
    OutputStream outputStream=System.out;
    InputReader in=new InputReader(inputStream);
    OutputWriter out=new OutputWriter(outputStream);
    NumberTheory nt= new NumberTheory();
    ProblemSolver problemSolver=new ProblemSolver();
    problemSolver.solveTheProblem(in,out, nt);
    out.flush();
    out.close();
  }

  static class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int peek() {
      if (numChars == -1) {
        return -1;
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          return -1;
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar];
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public String nextLine() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      StringBuilder res = new StringBuilder();
      do {
        if (Character.isValidCodePoint(c)) {
          res.appendCodePoint(c);
        }
        c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
      StringBuilder buf = new StringBuilder();
      int c = read();
      while (c != '\n' && c != -1) {
        if (c != '\r') {
          buf.appendCodePoint(c);
        }
        c = read();
      }
      return buf.toString();
    }

    public String readLine() {
      String s = readLine0();
      while (s.trim().length() == 0) {
        s = readLine0();
      }
      return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
      if (ignoreEmptyLines) {
        return readLine();
      } else {
        return readLine0();
      }
    }

    public BigInteger readBigInteger() {
      try {
        return new BigInteger(nextLine());
      } catch (NumberFormatException e) {
        throw new InputMismatchException();
      }
    }

    public char nextCharacter() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      return (char) c;
    }

    public double nextDouble() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      double res = 0;
      while (!isSpaceChar(c) && c != '.') {
        if (c == 'e' || c == 'E') {
          return res * Math.pow(10, nextInt());
        }
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      }
      if (c == '.') {
        c = read();
        double m = 1;
        while (!isSpaceChar(c)) {
          if (c == 'e' || c == 'E') {
            return res * Math.pow(10, nextInt());
          }
          if (c < '0' || c > '9') {
            throw new InputMismatchException();
          }
          m /= 10;
          res += (c - '0') * m;
          c = read();
        }
      }
      return res * sgn;
    }

    public boolean isExhausted() {
      int value;
      while (isSpaceChar(value = peek()) && value != -1) {
        read();
      }
      return value == -1;
    }

    public String next() {
      return nextLine();
    }

    public SpaceCharFilter getFilter() {
      return filter;
    }

    public void setFilter(SpaceCharFilter filter) {
      this.filter = filter;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
    public int[] nextIntArray(int n){
      int[] array=new int[n];
      for(int i=0;i<n;++i)array[i]=nextInt();
      return array;
    }
    public int[] nextSortedIntArray(int n){
      int array[]=nextIntArray(n);
      Arrays.sort(array);
      return array;
    }
    public ArrayList<Integer> nextIntArrayList(int n){
      ArrayList<Integer> ar= new ArrayList<>();
      for(int i=0;i<n;i++)
        ar.add(nextInt());
      return ar;
    }
		public ArrayList<Long> nextLongArrayList(int n){
      ArrayList<Long> ar= new ArrayList<>();
      for(int i=0;i<n;i++)
        ar.add(nextLong());
      return ar;
    }

    public int[] nextSumIntArray(int n){
      int[] array=new int[n];
      array[0]=nextInt();
      for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
      return array;
    }
    public long[] nextLongArray(int n){
      long[] array=new long[n];
      for(int i=0;i<n;++i)array[i]=nextLong();
      return array;
    }
    public long[] nextSumLongArray(int n){
      long[] array=new long[n];
      array[0]=nextInt();
      for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
      return array;
    }
    public long[] nextSortedLongArray(int n){
      long array[]=nextLongArray(n);
      Arrays.sort(array);
      return array;
    }
    public int[][] nextIntMatrix(int n,int m){
      int[][] matrix=new int[n][m];
      for(int i=0;i<n;++i)
      for(int j=0;j<m;++j)
      matrix[i][j]=nextInt();
      return matrix;
    }

    public int[][] nextIntMatrix(int n){
      return nextIntMatrix(n,n);
    }

    public long[][] nextLongMatrix(int n,int m){
      long[][] matrix=new long[n][m];
      for(int i=0;i<n;++i)
      for(int j=0;j<m;++j)
      matrix[i][j]=nextLong();
      return matrix;
    }

    public long[][] nextLongMatrix(int n){
      return nextLongMatrix(n,n);
    }

    public char[][] nextCharMatrix(int n,int m){
      char[][] matrix=new char[n][m];
      for(int i=0;i<n;++i)
      matrix[i]=next().toCharArray();
      return matrix;
    }

    public char[][] nextCharMatrix(int n){
      return nextCharMatrix(n,n);
    }
  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    // public void print(char[] array) {
    //     writer.print(array);
    // }

    public void print(Object... objects) {
      for (int i = 0; i < objects.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(objects[i]);
      }
    }

    public void print(int[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(double[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(long[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(char[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(String[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(int[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(double[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(long[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(char[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(String[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void println(int[] array) {
      print(array);
      writer.println();
    }

    public void println(double[] array) {
      print(array);
      writer.println();
    }

    public void println(long[] array) {
      print(array);
      writer.println();
    }

    // public void println(char[] array) {
    //     print(array);
    //     writer.println();
    // }

    public void println(String[] array) {
      print(array);
      writer.println();
    }

    public void println() {
      writer.println();
    }

    public void println(Object... objects) {
      print(objects);
      writer.println();
    }

    public void print(char i) {
      writer.print(i);
    }

    public void println(char i) {
      writer.println(i);
    }

    public void println(char[] array) {
      writer.println(array);
    }

    public void printf(String format, Object... objects) {
      writer.printf(format, objects);
    }

    public void close() {
      writer.close();
    }

    public void flush() {
      writer.flush();
    }

    public void print(long i) {
      writer.print(i);
    }

    public void println(long i) {
      writer.println(i);
    }

    public void print(int i) {
      writer.print(i);
    }

    public void println(int i) {
      writer.println(i);
    }

    public void separateLines(int[] array) {
      for (int i : array) {
        println(i);
      }
    }
  }
  static class NumberTheory{

      /**
       * Modular Arithmetic:
       *  1. (a+b)%c=(a%c+b%c)%c
       *  2. (a*b)%c=(a%c*b%c)%c
       *  3. (a-b)%c=(a%c-b%c+c)%c
       *  4. (a/b)%c=(a%c*(b^-1)%c)%c -- (b^-1 is multiplicative modulo inverse)
       */
      //Modular Addition
      public int modularAddition(int a,int b,int MOD){
          return (a%MOD+b%MOD)%MOD;
      }
      public long modularAddition(long a,long b,long MOD){
          return (a%MOD+b%MOD)%MOD;
      }
      //Modular Multiplication
      public int modularMultiplication(int a,int b,int MOD){
          return ((a%MOD)*(b%MOD))%MOD;
      }
      public long modularMultiplication(long a,long b,long MOD){
          return ((a%MOD)*(b%MOD))%MOD;
      }
      //Modular Subtraction
      public int modularSubtraction(int a,int b,int MOD){
          return (a%MOD-b%MOD+MOD)%MOD;
      }
      public long modularSubtraction(long a,long b,long MOD){
          return (a%MOD-b%MOD+MOD)%MOD;
      }

      /**
       * Binary Exponentiation
       */
      public int binaryExponentiation(int x,int n){
          if(n==0)return 1;
          else if(n%2==0)return binaryExponentiation(x*x,n/2);
          else return x*binaryExponentiation(x*x,(n-1)/2);
      }
      public long binaryExponentiation(long x,long n){
          long result=1;
          while(n>0){
              if(n%2==1)result*=x;
              x=x*x;
              n/=2;
          }
          return result;
      }

      /**
       * Modular Exponentiation
       */
      public int modularExponentiation(int x,int n,int MOD){
          if(n==0)return 1%MOD;
          else if(n%2==0)return modularExponentiation(modularMultiplication(x,x,MOD),n/2,MOD);
          else return modularMultiplication(x,modularExponentiation(modularMultiplication(x,x,MOD),(n-1)/2,MOD),MOD);
      }
      public long modularExponentiation(long x,long n,long MOD){
          long result=1;
          while(n>0){
              if(n%2==1)result=modularMultiplication(result,x,MOD);
              x=modularMultiplication(x,x,MOD);
              n/=2;
          }
          return result;
      }

      /**
       * Factorial of a number
       */
      public long factorials(long n){
          if(n==0)return 1;
          return n*factorials(n-1);
      }

      /**
       * Prime factors of a number
       */
      public ArrayList<Integer> distinctPrimeFactors(int n){
          ArrayList<Integer> factorials=new ArrayList<>();
          int limit=(int)Math.sqrt(n);
          if(n%2==0){
              factorials.add(2);
              while(n%2==0)n/=2;
          }
          for(int i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Long> distinctPrimeFactors(long n){
          ArrayList<Long> factorials=new ArrayList<>();
          long limit=(long)Math.sqrt(n);
          if(n%2==0){
              factorials.add((long)2);
              while(n%2==0)n/=2;
          }
          for(long i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Integer> primeFactors(int n){
          ArrayList<Integer> factorials=new ArrayList<>();
          int limit=(int)Math.sqrt(n);
          if(n%2==0){
              factorials.add(2);
              while(n%2==0)n/=2;
          }
          for(int i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Long> primeFactors(long n){
          ArrayList<Long> factorials=new ArrayList<>();
          long limit=(long)Math.sqrt(n);
          if(n%2==0){
              factorials.add((long)2);
              while(n%2==0)n/=2;
          }
          for(long i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      /**
       * Combination: nCr
       */
      //Naive version
      //(n,r)=(n-1,r-1)+(n-1,r) for r!=0 or r!=n
      //(n,0)=(n,n)=1
      public int binomialCoefficientRecursive(int n,int k){
          if(k==0 || k==n)return 1;//base case
          return binomialCoefficientRecursive(n-1,k-1)+binomialCoefficientRecursive(n-1,k);//recursion
      }

      //Dynamic Programming version(Uses bottom up approach to fill the table)
      //Time complexity: O(n*k)
      //Space complexity: O(n*k)
      public long binomialCoefficientIterative(int n,int k){
          long[][] C=new long[n+1][k+1];
          for(int i=0;i<=n;++i){
              for(int j=0;j<=Math.min(n,k);++j){
                  if(j==0 || j==i)C[i][j]=1;
                  else C[i][j]=C[i-1][j-1]+C[i-1][j];
              }
          }
          return C[n][k];
      }

      //Pascal's Triangle version(Space efficient program)
      //Time complexity: O(n*k)
      //Space complexity: O(k)
      public long nCr(int n,int r){
          int[] C=new int[r+1];
          C[0]=1;//nC0=1
          for(int i=1;i<=n;++i)
              for(int j=Math.min(i,r);j>0;--j)
                  C[j]=C[j]+C[j-1];
          return C[r];
      }

      /**
       * Catlan number:
       *  - Time complexity: O(n*n)
       *  - Auxiliary space: O(n)
       *
       *  NOTE: Time complexity could be reduced to O(n) but it is
       *        possible if and only if n is small or else there is
       *        a chance of getting an overflow. To decrease the time
       *        complexity to O(n) just remember nCr=nCn-r
       */
      public long catlanNumber(int n){
          long[] catlan=new long[n+1];
          catlan[0]=catlan[1]=1;
          for(int i=2;i<=n;++i)
              for(int j=0;j<i;++j)
                  catlan[i]+=catlan[j]*catlan[i-1-j];

          return catlan[n];
      }

      /**
       * Greatest Common Divisor(GCD)
       *  - It is also known as Highest Common Factor(HCF)
       *  - Time complexity: log(min(a,b))
       *  - Auxiliary Space: O(1)
       */
      public int gcd(int a,int b){
          if(b==0)return a;
          return gcd(b,a %b);
      }

      public long gcd(long a,long b){
          if(b==0)return a;
          return gcd(b,a%b);
      }

      /**
       * Extended Euclid's Algorithm:
       *  - ax+by=gcd(a,b)
       *  - Time complexity:
       *  -
       */

      /**
       * Least Common Multiple(LCM):
       *  - Time complexity: log(min(a,b))
       *  - Auxiliary Space: O(1)
       */
      public long lcm(long a,long b){
          return (a*b)/gcd(a,b);
      }

  }
}
//
//                       "8,        .m8"
//                        I8Im    ,mI8"
//                        ,8I""I8,mI8m
//             "I8mm,    ,I8    I8 "I8,          ,m"
//                "I88I88I8m ,I8"   "I8""==mm ,mI8"
//        ___    ,mI8"    "8I8"      I8,  ,mI8I8"
//   .,mI8I8I8I8I88,      ,m8"      ,I8I8I8I888"
// "I8Im,       "I88,    ,8"      ,II8"     "88,
//    `"I8,        "I8, ,8"     ,I8"         "I8,
//       "I8m       "I888      ,I8"           "I8,
//         "8m        "I8      88"              "I8,
//          I8,        I8      88                 "I8,
//           88,       I8,     "I8                 "I8
//           "I8,      "I8,     "I8,                I8;.
//            "I8,      "I8,      "I8        .,mmmI8888888m,.
//              I8,      "I8,      I8,  .mI8I88"""". .. "I8888
//              "I8,      "I8      mI8I88"". . . . . .,m8"   "8
//               I8m,  __ ;I8   ,II88" . . . . .,;miI88"
//               "I88I8I88I88,,I88" . . . ,mmiiI8888"
//                ,I8". . ."I8I8". . . mi888888888"
//              ,I8 . . . .,I88I. . .i88888888888"
//             I8. . . .,mII88Ima. .i88888888888"
//            ,8"..,mI88I88I88I8Imi888888888888"
//            I8.,I8I"""        ""II88888888888
//           ;I8I8"                  ""I8888888
//           ""                         "I88888
//                                        "I888
//                                         "I88,
//                                          "I88
//                                           "88,
//                                            I88,              ______   __
//                           ______           "I88__        .mI88I88I88I88I88,
//                      .,mI88I88I88, ,mI88,   I88"""     ,mI8". . . . "I8,..8,
//                    ,I888' . . . "I88.\ "8,  I88      ,I8". . . .  / :;I8 \ 8,
//                  .mI8' . . .  / .:"I8.\ 88  "88,    ,8". . .  / .;mI8I8I8,\ 8
//                 ,I8'. . .  / . .:;,I8I8I888  I88   ,8". .  / .:mI8"'   "I8,:8
//                ,I8'. . . / . .:;,mI8"  `"I88 I88   I8. .  / .m8"         "I8I
//               ,I8 . .  / . .:;,mI8"      "I88888   88,.  / ,m8            "8'
//               I8'. .  / . .;,mI8"          "II888 ,I8I8,.,I8"
//               I8 . . / . .,mI8"              I8888888' """
//               `I8,.  / ;,mI8"                 II888
//                "I8I, /,mI8"                 __I888
//                  "I8888"                   """I88
//                    ""                         I88
//                                               I88__
//                                               I88"""
//                                               I88
//                                               I88
//                                             __I88
//                                            """I88
//                                               I88
//                                               I88
//                                               I88__
//                                               I88"""
//                                               I88
//                                        BITSY  ___  CHUCK

import java.util.Scanner;

public class A275 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String txt = input.nextLine()+input.nextLine()+input.nextLine();
        int index=0;
        char[] arr = txt.replaceAll(" ", "").toCharArray();
        boolean[][] light = new boolean[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (arr[index] % 2 != 0) {
                    light[i][j] = !light[i][j];
                    if (i < 2) {
                        light[i + 1][j] = !light[i + 1][j];
                    }
                    if (i > 0) {
                        light[i - 1][j] = !light[i - 1][j];
                    }
                    if (j < 2) {
                        light[i][j + 1] = !light[i][j + 1];
                    }
                    if (j > 0) {
                        light[i][j - 1] = !light[i][j - 1];
                    }
                }
                index++;
            }
        }
        String answer;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                answer= light[i][j] ? "0" : "1";
                System.out.print(answer);
            }
            System.out.println("");
        }
    }

}

import java.util.Scanner;
public class Robo3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = 3;
        int a[][] = new int[n][n];
        int ans[][] = new int[n][n];
        for (int i=0; i<3; i++) {
            for (int j=0; j<3; j++) {
                a[i][j] = in.nextInt();
                ans[i][j] = ans[i][j] + a[i][j];
                if (i-1>=0) ans[i-1][j] = ans[i-1][j] + a[i][j];
                if (j-1>=0) ans[i][j-1] = ans[i][j-1] + a[i][j];
                if (i+1<3) ans[i+1][j] = ans[i+1][j] + a[i][j];
                if (j+1<3) ans[i][j+1] = a[i][j+1] + a[i][j];
            }
        }
        for (int i=0;i<3;i++) {
            for (int j=0;j<3;j++) {
                ans[i][j] = ans[i][j] %2;
                if (ans[i][j] == 0) ans[i][j] = 1;
                else ans[i][j] = 0;
                System.out.print(ans[i][j]+"");
            }
                System.out.println();
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

    private static BufferedReader reader =
        new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args)
    {
        try
        {
            int[][] matrix = new int[5][5];
            int row = 1; int col = 1;
            for(int i = 0; i<3; i++) {
                String[] op = reader.readLine().split(" ");
                col = 1;
                for(String p : op) {
                    int opcode = Integer.parseInt(p);
                    if((opcode & 1) == 1) {
                        matrix[row-1][col] = (matrix[row-1][col] == 1) ? 0 : 1;
                        matrix[row+1][col] = (matrix[row+1][col] == 1) ? 0 : 1;
                        matrix[row][col-1] = (matrix[row][col-1] == 1) ? 0 : 1;
                        matrix[row][col+1] = (matrix[row][col+1] == 1) ? 0 : 1;
                        matrix[row][col] = (matrix[row][col] == 1) ? 0 : 1;
                    }
                    col++;
                }
                row++;
            }
            StringBuffer result = new StringBuffer();
            String line = "";
            for(int i = 1; i<4; i++) {
                for(int j = 1; j<4; j++) {
                    line += (matrix[i][j] == 0 ? 1 : 0)+" ";
                }
                result.append(line.trim());
                result.append("\n");
                line = "";
            }

            System.out.println(result.toString());
        }
        catch (NumberFormatException e)
        {
            e.printStackTrace();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}

import java.util.*;
import java.io.*;
public class lightsout
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
        FastReader()
        {
            br=new BufferedReader(new InputStreamReader(System.in));
        }
        String next()
        {
            while(st==null||!st.hasMoreElements())
            {
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                    //TODO: handle exception
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }
    }
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        int toggle[][]=new int[3][3];
        int state[][]=new int[3][3];
        int i=0,j=0;int sum=0;
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
                toggle[i][j]=sc.nextInt();
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                sum=toggle[i][j];
                if(i<2)
                {
                    sum=sum+toggle[i+1][j];
                    if(j+1<3)
                    {
                        sum=sum+toggle[i+1][j+1];
                    }
                    if(j-1>=0)
                    {
                        sum=sum+toggle[i+1][j-1];
                    }
                }
                if(i>0)
                {
                    sum=sum+toggle[i-1][j];
                    if(j+1<3)
                    {
                        sum=sum+toggle[i-1][j+1];
                    }
                    if(j-1>=0)
                    {
                        sum=sum+toggle[i-1][j-1];
                    }
                }
                if(j<2)
                {
                    sum=sum+toggle[i][j+1];
                }
                if(j>0)
                {
                    sum=sum+toggle[i][j-1];
                }
                System.out.println(sum);
                if(sum%2==0)
                {
                    state[i][j]=1;
                }
                else
                {
                    state[i][j]=0;
                }
            }
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            System.out.print(state[i][j]+" ");
            System.out.println();
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A275LightsOut
{
	public static void main(String[] args) throws IOException
	{	int xA []={ 1, 1, 0,-1,-1,-1, 0, 1};
		int yA []={ 0, 1, 1, 1, 0,-1,-1,-1};
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		int in [][] = new int [3][3];int outp [][]= new int [3][3];
		for(int i=0;i<3;i++)
		{	String line []=br.readLine().split(" ");
			for(int j=0;j<3;j++)
			{
				in[i][j]=Integer.parseInt(line[j]);
				outp[i][j]=1;
			}

		}

		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
			{
				if(in[i][j]%2!=0)
				{	outp[i][j]=1-in[i][j];
					for(int k=0;k<8;k++)
					{
						int x =xA[k]+j;
						int y =yA[k]+i;
						if(x<0||x>2)
							continue;
						if(y<0||y>2)
							continue;
						outp[y][x]=1-outp[y][x];
					}
				}
			}
		StringBuilder sb = new StringBuilder("");
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{

				sb.append(outp[i][j]);
			}
			sb.append("\n");

		}
		System.out.println(sb.toString());
	}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        int[][] array = new int[3][3];
        int[][] array1=new int [3][3];
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {
                array[i][j] = input.nextInt();
            }

        }
        array1[0][0]=array[0][0]+array[0][1]+array[1][0];
        array1[0][1]=array[0][1]+array[0][0]+array[0][2]+array[1][1];
        array1[0][2]=array[0][2]+array[0][1]+array[1][2];
        array1[1][0]=array[1][0]+array[0][0]+array[1][1]+array[2][0];
        array1[1][1]=array[1][1]+array[0][1]+array[1][0]+array[1][2]+array[1][1];
        array1[1][2]=array[1][2]+array[0][2]+array[1][1]+array[2][2];
        array1[2][0]=array[2][0]+array[1][0]+array[2][1];
        array1[2][1]=array[2][1]+array[2][0]+array[1][1]+array[2][2];
        array1[2][2]=array[2][2]+array[1][2]+array[2][1];

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {
                if (array1[i][j]%2==0) {
                    System.out.print("1");
                } else {
                    System.out.print("0");

                }

            }
            System.out.print("\n");
        }
    }

}

import java.util.Arrays;
import java.util.Scanner;

public class LightsOut {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] arr = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				arr[i][j] = 1;
			}
		}
		/*
		 * row col row +1 col row -1 col row +1 col +1 row col+1 row col-;
		 *
		 */
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				int x = sc.nextInt();
				if (x % 2 != 0) {
					try {
						if (arr[i][j] == 1)
							arr[i][j] = 0;
						else
							arr[i][j] = 1;
					} catch (Exception e) {
					}

					try {
						if (arr[i + 1][j] == 1)
							arr[i + 1][j] = 0;
						else
							arr[i + 1][j] = 1;
					} catch (Exception e) {}
					try {
					if (arr[i - 1][j] == 1)
						arr[i - 1][j] = 0;
					else
						arr[i - 1][j] = 1;
					}catch(Exception e) {}
					try {
					if (arr[i + 1][j + 1] == 1)
						arr[i + 1][j + 1] = 0;
					else
						arr[i + 1][j + 1] = 1;
					}catch(Exception e){}
					try {
					if (arr[i][j + 1] == 1)
						arr[i][j + 1] = 0;
					else
						arr[i][j + 1] = 1;
					}catch(Exception e) {}
					try {
					if (arr[i][j - 1] == 1)
						arr[i][j - 1] = 0;
					else
						arr[i][j - 1] = 1;
					}catch(Exception e) {}
					try {
						if(arr[i-1][j-1]==0)arr[i-1][j-1]=1;
						else arr[i-1][j-1]=0;
					}catch(Exception e) {}
				}
			}
		}
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				System.out.print(arr[i][j]);
			}
			System.out.println();
		}
	}

}

import java.io.PrintWriter;
import java.util.Scanner;

public class P275A
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int[][] matrix = new int[3][3];
		for (int i=0; i<3; i++)
		{

			for (int j=0; j<3; j++)
			{
				int value  = in.nextInt();
				for (int x=i-1; x<=i+1; x++)
				{
					for (int y=j-1; y<=j+1; y++)
					{
						if (-1<x && x<3 && -1<y && y<3)
						{
							matrix[x][y] += value;
						}
					}
				}

			}
		}

		PrintWriter writer = new PrintWriter(System.out);
		for (int i=0; i<3; i++)
		{
			for (int j=0; j<3; j++)
			{
				writer.print((matrix[i][j]+1)%2);
			}
			writer.println();
		}

		writer.close();

	}

}

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        boolean[][] grid = new boolean[5][5];
        //print(grid);
                System.out.println();
        for (int i = 1; i < 4; i++) {
            for (int j = 1; j < 4; j++) {
                int presses = in.nextInt();
                if (presses % 2 != 0) {
                    grid[i][j] = !grid[i][j];
                    grid[i][j - 1] = !grid[i][j - 1];
                    grid[i][j + 1] = !grid[i][j + 1];

                    grid[i + 1][j] = !grid[i + 1][j];
                    grid[i + 1][j - 1] = !grid[i + 1][j - 1];
                    grid[i + 1][j + 1] = !grid[i + 1][j + 1];

                    grid[i - 1][j] = !grid[i - 1][j];
                    grid[i - 1][j - 1] = !grid[i - 1][j - 1];
                    grid[i - 1][j + 1] = !grid[i - 1][j + 1];
                }
                //print(grid);
                //System.out.println();
            }
        }

        for (int i = 1; i < 4; i++) {
            for (int j = 1; j < 4; j++) {
                System.out.print((grid[i][j]) ? "0" : "1");
            }
            System.out.println("");
        }

    }

    public static void print(boolean[][] grid) {
        for (int i = 1; i < 4; i++) {
            for (int j = 1; j < 4; j++) {
                System.out.print((grid[i][j]) ? "0" : "1");
            }
            System.out.println();
        }
    }
}

//package userInput;
import java.util.Scanner;

public class ScannerUserInput {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int l11, l12, l13, l21, l22, l23, l31, l32, l33;
		l11 = sc.nextInt();
		l12 = sc.nextInt();
		l13 = sc.nextInt();
		l21 = sc.nextInt();
		l22 = sc.nextInt();
		l23 = sc.nextInt();
		l31 = sc.nextInt();
		l32 = sc.nextInt();
		l33 = sc.nextInt();

		if((l12 + l11 + l21) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		if((l12 + l11 + l13 + l22) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		if((l12 + l13 + l21) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		System.out.println();

		if((l21 + l11 + l22) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		if((l22 + l21 + l23 + l12 + l32) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		if((l22 + l13 + l33 + l23) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		System.out.println();

		if((l31 + l21 + l32) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		if((l32 + l22 + l31 + l33) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		if((l23 + l33 + l32) % 2==0)
			System.out.print("1");
		else System.out.print("0");

		System.out.println();
	}
}

import java.io.*;
import java.util.*;
import java.lang.*;

public class sol
{
  	public static void main (String[] args)throws IOException{
		//code

		Scanner sc = new Scanner(System.in);

		int press[][] = new int[3][3];
		int ans[][] = new int[3][3];
		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        press[i][j] = sc.nextInt();
		        ans[i][j] = 1;
		    }
		}
		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		       if(press[i][j] == 0 || press[i][j]%2==0)continue;
		       else
		       {
		           ans[i][j] = 1-ans[i][j];
		           if(j+1 < 3)ans[i][j+1] = 1-ans[i][j+1];
		           if(i+1 < 3)ans[i+1][j] = 1-ans[i+1][j];
		           if(j-1 >= 0)ans[i][j-1] = 1-ans[i][j-1];
		           if(i-1 >= 0)ans[i-1][j] = 1-ans[i-1][j];
		       }

		    }
		}
		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        System.out.print(ans[i][j]+" ");
		    }
		    System.out.println();
		}

    }
}

import java.util.Scanner;

public class A {

    static class Grid {
        boolean[][] grid = new boolean[3][3];
        int[][] dxy = {
                {0, 1},
                {0, -1},
                {1, 0},
                {-1, 0}
        };
        public void toggle(int i, int j) {
            grid[i][j] = !grid[i][j];
            for (int d=0; d<dxy.length; d++) {
                int ni = i + dxy[d][0];
                int nj = j + dxy[d][1];
                if (ni >= 0 && ni < 3 && nj >= 0 && nj < 3) {
                    grid[ni][nj] = !grid[ni][nj];
                }
            }
        }
        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();
            for (int i=0; i<3; i++) {
                sb.append(grid[i][0] ? 0 : 1).append(' ');
                sb.append(grid[i][1] ? 0 : 1).append(' ');
                sb.append(grid[i][2] ? 0 : 1).append('\n');
            }
            return sb.toString();
        }
    }
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        Grid g = new Grid();
        for (int i=0; i<3; i++) {
            for (int j=0; j<3; j++) {
                int t = s.nextInt();
                if ((t & 1) != 0) {
                    g.toggle(i, j);
                }
            }
        }
        System.out.println(g);
    }

}

/* package codechef; // don't place package name! */

import java.math.BigInteger;
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{
    // Complete the maximumSum function below.
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static boolean prime(long a){
        if(a==2||a==3)
            return true;
        if((a-1)%6==0)
            return true;
        if((a+1)%6==0)
            return true;
        return false;
    }
    public static  long gcd(long a,long b){
        if(b==0)
            return a;
        long r=a%b;
        return gcd(b,r);
    }

    static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

    public class ListNode {
        int val;
        ListNode next;
        ListNode() {}
        ListNode(int val) { this.val = val; }
        ListNode(int val, ListNode next) { this.val = val; this.next = next; }
    }

    public class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode() {}
      TreeNode(int val) { this.val = val; }
      TreeNode(int val, TreeNode left, TreeNode right) {
          this.val = val;
          this.left = left;
          this.right = right;
      }
    }

    class Node {
        public int val;
        public List<Node> children;

        public Node() {}

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    // private static final FastReader scanner = new FastReader();
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader scanner = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int arr[][]=new int[5][5];
        for(int i=1;i<=3;i++){
            for(int j=1;j<=3;j++){
                int x=scanner.nextInt();
                arr[i][j]=x%2;
            }
        }
        for(int i=1;i<=3;i++){
            for(int j=1;j<=3;j++){
                int x=(arr[i][j]+arr[i][j-1]+arr[i-1][j]+arr[i][j+1]+arr[i+1][j]+1)%2;
                w.print(x+" ");
            }
            w.println();
        }
        w.close();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        GetInput getInput = new GetInput();
        int [][]array = new int[3][3];
        for (int i = 0 ; i < 3 ; i++){
            array[i] = getInput.getArrayInt();
        }
        int [][]arrayOut = new int[3][3];

        for (int i = 0 ; i<3 ;  i++){
            for (int j = 0 ; j < 3 ; j++){
                addLeft(array,arrayOut,i,j);
                addRight(array,arrayOut,i,j);
                addTop(array,arrayOut,i,j);
                addBot(array,arrayOut,i,j);
            }
        }

        for (int i = 0 ; i < 3; i++){
            for (int j = 0 ; j< 3 ; j++){
                System.out.print((arrayOut[i][j]+array[i][j]+1)%2+" ");
            }
            System.out.println();
        }

    }

    private static void addBot(int[][] array,int[][] arrayOut, int i, int j) {
        if (i+1 < 3){
            arrayOut[i][j] += array[i+1][j];
        }
    }

    private static void addTop(int[][] array,int[][] arrayOut, int i, int j) {
        if (i-1 > -1){
            arrayOut[i][j] += array[i-1][j];
        }

    }

    private static void addRight(int[][] array,int[][] arrayOut, int i, int j) {
        if (j+1 < 3){
            arrayOut[i][j] += array[i][j+1];
        }
    }

    private static void addLeft(int[][] array,int[][] arrayOut, int i, int j) {
        if (j-1 > -1){
            arrayOut[i][j] += array[i][j-1];
        }
    }

}

class GetInput{
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
    int [] getArrayInt(){
        String []string;
        int []array;
        try {
            string = bufferedReader.readLine().split("\\s+");
            array  = new int[string.length];
            for (int i = 0; i < string.length; i++) {
                array[i] = Integer.parseInt(string[i]);
            }
            return array;
        } catch (IOException e) {
            e.printStackTrace();
        }

        int []arra = new int[2];
        return arra;
    }

    int getInt(){
        try {
            String string = bufferedReader.readLine();
            return Integer.parseInt(string);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return 0;
    }

    StringBuilder getInputString(){
        try {
            StringBuilder string = new StringBuilder();
            string.append(bufferedReader.readLine());
            return string;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return new StringBuilder();
    }
}

import java.util.*;
import java.io.*;
public class solution{
    public static void main(String [] args){
        Scanner sc=new Scanner(System.in);
        int [][]temp=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                int x=sc.nextInt();
                if(i-1>=0) temp[i-1][j]+=x;
                if(i+1<3) temp[i+1][j]+=x;
                if(j+1<3) temp[i][j+1]+=x;
                if(j-1>=0) temp[i][j-1]+=x;
            }
        }
        int [][]res=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(temp[i][j]%2==0) System.out.print("1");
                else System.out.print("0");
            }
            System.out.println();
        }
    }
}

import java.util.Scanner;

public class main {

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);

		int matriz [][] = new int[3][3];
		boolean boolmatriz [][] = new boolean[5][5];

		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				matriz [i][j] = scan.nextInt();

				for (int j2 = 0; j2 < matriz[i][j]; j2++) {
					if(boolmatriz[i+1][j+2]) {boolmatriz[i+1][j+2] = false;}
					else boolmatriz[i+1][j+2] = true;

					if(boolmatriz[i+1][j]) {boolmatriz[i+1][j] = false;}
					else boolmatriz[i+1][j] = true;

					if(boolmatriz[i][j+1]) {boolmatriz[i][j+1] = false;}
					else boolmatriz[i][j+1] = true;

					if(boolmatriz[i+2][j+1]) {boolmatriz[i+2][j+1] = false;}
					else boolmatriz[i+2][j+1] = true;

					if(boolmatriz[i+1][j+1]) {boolmatriz[i+1][j+1] = false;}
					else boolmatriz[i+1][j+1] = true;
				}
			}
		}

		for (int i = 1; i < boolmatriz.length-1; i++) {System.out.println();
			for (int j = 1; j < boolmatriz.length-1; j++) {
				if(boolmatriz[i][j]){
				System.out.print(0);
					}else System.out.print(1);
				}
		}
	}
}

import java.io.Writer;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.math.*;

public class A275{
  static class ProblemSolver{
    static int[][] changeState(int s[][], int i, int j, int k){
      try{
        s[i-1][j]^=k;
      }
      catch(Exception e){ }
      try{
        s[i+1][j]^=k;
      }
      catch(Exception e){ }
      try{
        s[i][j-1]^=k;
      }
      catch(Exception e){ }
      try{
        s[i][j+1]^=k;
      }
      catch(Exception e){ }
      return s;
    }
    public void solveTheProblem(InputReader in,OutputWriter out, NumberTheory nt){
      int test=1;//in.nextInt();
      while(test-- >0){
        int ar[][]= new int[3][3];
        ar=in.nextIntMatrix(3, 3);
        int s[][]= new int[3][3];
        for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
            s[i][j]=1;
          }
        }
        for(int i=0;i<3;i++){
          for(int j=0;j<3;j++){
            if(ar[i][j]%2==1){
              s[i][j]=0;
              s=changeState(s, i, j, 1);
            }
          }
        }
        for(int i=0;i<3;i++){
          String ans="";
          for(int j=0;j<3;j++){
            ans+=s[i][j];
          }
          System.out.println(ans);
        }
      }
    }
  }

  public static void main(String[] args){
    InputStream inputStream=System.in;
    OutputStream outputStream=System.out;
    InputReader in=new InputReader(inputStream);
    OutputWriter out=new OutputWriter(outputStream);
    NumberTheory nt= new NumberTheory();
    ProblemSolver problemSolver=new ProblemSolver();
    problemSolver.solveTheProblem(in,out, nt);
    out.flush();
    out.close();
  }

  static class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int peek() {
      if (numChars == -1) {
        return -1;
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          return -1;
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar];
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public String nextLine() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      StringBuilder res = new StringBuilder();
      do {
        if (Character.isValidCodePoint(c)) {
          res.appendCodePoint(c);
        }
        c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
      StringBuilder buf = new StringBuilder();
      int c = read();
      while (c != '\n' && c != -1) {
        if (c != '\r') {
          buf.appendCodePoint(c);
        }
        c = read();
      }
      return buf.toString();
    }

    public String readLine() {
      String s = readLine0();
      while (s.trim().length() == 0) {
        s = readLine0();
      }
      return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
      if (ignoreEmptyLines) {
        return readLine();
      } else {
        return readLine0();
      }
    }

    public BigInteger readBigInteger() {
      try {
        return new BigInteger(nextLine());
      } catch (NumberFormatException e) {
        throw new InputMismatchException();
      }
    }

    public char nextCharacter() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      return (char) c;
    }

    public double nextDouble() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      double res = 0;
      while (!isSpaceChar(c) && c != '.') {
        if (c == 'e' || c == 'E') {
          return res * Math.pow(10, nextInt());
        }
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      }
      if (c == '.') {
        c = read();
        double m = 1;
        while (!isSpaceChar(c)) {
          if (c == 'e' || c == 'E') {
            return res * Math.pow(10, nextInt());
          }
          if (c < '0' || c > '9') {
            throw new InputMismatchException();
          }
          m /= 10;
          res += (c - '0') * m;
          c = read();
        }
      }
      return res * sgn;
    }

    public boolean isExhausted() {
      int value;
      while (isSpaceChar(value = peek()) && value != -1) {
        read();
      }
      return value == -1;
    }

    public String next() {
      return nextLine();
    }

    public SpaceCharFilter getFilter() {
      return filter;
    }

    public void setFilter(SpaceCharFilter filter) {
      this.filter = filter;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
    public int[] nextIntArray(int n){
      int[] array=new int[n];
      for(int i=0;i<n;++i)array[i]=nextInt();
      return array;
    }
    public int[] nextSortedIntArray(int n){
      int array[]=nextIntArray(n);
      Arrays.sort(array);
      return array;
    }
    public ArrayList<Integer> nextIntArrayList(int n){
      ArrayList<Integer> ar= new ArrayList<>();
      for(int i=0;i<n;i++)
        ar.add(nextInt());
      return ar;
    }
		public ArrayList<Long> nextLongArrayList(int n){
      ArrayList<Long> ar= new ArrayList<>();
      for(int i=0;i<n;i++)
        ar.add(nextLong());
      return ar;
    }

    public int[] nextSumIntArray(int n){
      int[] array=new int[n];
      array[0]=nextInt();
      for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
      return array;
    }
    public long[] nextLongArray(int n){
      long[] array=new long[n];
      for(int i=0;i<n;++i)array[i]=nextLong();
      return array;
    }
    public long[] nextSumLongArray(int n){
      long[] array=new long[n];
      array[0]=nextInt();
      for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
      return array;
    }
    public long[] nextSortedLongArray(int n){
      long array[]=nextLongArray(n);
      Arrays.sort(array);
      return array;
    }
    public int[][] nextIntMatrix(int n,int m){
      int[][] matrix=new int[n][m];
      for(int i=0;i<n;++i)
      for(int j=0;j<m;++j)
      matrix[i][j]=nextInt();
      return matrix;
    }

    public int[][] nextIntMatrix(int n){
      return nextIntMatrix(n,n);
    }

    public long[][] nextLongMatrix(int n,int m){
      long[][] matrix=new long[n][m];
      for(int i=0;i<n;++i)
      for(int j=0;j<m;++j)
      matrix[i][j]=nextLong();
      return matrix;
    }

    public long[][] nextLongMatrix(int n){
      return nextLongMatrix(n,n);
    }

    public char[][] nextCharMatrix(int n,int m){
      char[][] matrix=new char[n][m];
      for(int i=0;i<n;++i)
      matrix[i]=next().toCharArray();
      return matrix;
    }

    public char[][] nextCharMatrix(int n){
      return nextCharMatrix(n,n);
    }
  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    // public void print(char[] array) {
    //     writer.print(array);
    // }

    public void print(Object... objects) {
      for (int i = 0; i < objects.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(objects[i]);
      }
    }

    public void print(int[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(double[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(long[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(char[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(String[] array) {
      for (int i = 0; i < array.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(array[i]);
      }
    }

    public void print(int[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(double[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(long[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(char[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void print(String[][] matrix){
      for(int i=0;i<matrix.length;++i){
        println(matrix[i]);
      }
    }

    public void println(int[] array) {
      print(array);
      writer.println();
    }

    public void println(double[] array) {
      print(array);
      writer.println();
    }

    public void println(long[] array) {
      print(array);
      writer.println();
    }

    // public void println(char[] array) {
    //     print(array);
    //     writer.println();
    // }

    public void println(String[] array) {
      print(array);
      writer.println();
    }

    public void println() {
      writer.println();
    }

    public void println(Object... objects) {
      print(objects);
      writer.println();
    }

    public void print(char i) {
      writer.print(i);
    }

    public void println(char i) {
      writer.println(i);
    }

    public void println(char[] array) {
      writer.println(array);
    }

    public void printf(String format, Object... objects) {
      writer.printf(format, objects);
    }

    public void close() {
      writer.close();
    }

    public void flush() {
      writer.flush();
    }

    public void print(long i) {
      writer.print(i);
    }

    public void println(long i) {
      writer.println(i);
    }

    public void print(int i) {
      writer.print(i);
    }

    public void println(int i) {
      writer.println(i);
    }

    public void separateLines(int[] array) {
      for (int i : array) {
        println(i);
      }
    }
  }
  static class NumberTheory{

      /**
       * Modular Arithmetic:
       *  1. (a+b)%c=(a%c+b%c)%c
       *  2. (a*b)%c=(a%c*b%c)%c
       *  3. (a-b)%c=(a%c-b%c+c)%c
       *  4. (a/b)%c=(a%c*(b^-1)%c)%c -- (b^-1 is multiplicative modulo inverse)
       */
      //Modular Addition
      public int modularAddition(int a,int b,int MOD){
          return (a%MOD+b%MOD)%MOD;
      }
      public long modularAddition(long a,long b,long MOD){
          return (a%MOD+b%MOD)%MOD;
      }
      //Modular Multiplication
      public int modularMultiplication(int a,int b,int MOD){
          return ((a%MOD)*(b%MOD))%MOD;
      }
      public long modularMultiplication(long a,long b,long MOD){
          return ((a%MOD)*(b%MOD))%MOD;
      }
      //Modular Subtraction
      public int modularSubtraction(int a,int b,int MOD){
          return (a%MOD-b%MOD+MOD)%MOD;
      }
      public long modularSubtraction(long a,long b,long MOD){
          return (a%MOD-b%MOD+MOD)%MOD;
      }

      /**
       * Binary Exponentiation
       */
      public int binaryExponentiation(int x,int n){
          if(n==0)return 1;
          else if(n%2==0)return binaryExponentiation(x*x,n/2);
          else return x*binaryExponentiation(x*x,(n-1)/2);
      }
      public long binaryExponentiation(long x,long n){
          long result=1;
          while(n>0){
              if(n%2==1)result*=x;
              x=x*x;
              n/=2;
          }
          return result;
      }

      /**
       * Modular Exponentiation
       */
      public int modularExponentiation(int x,int n,int MOD){
          if(n==0)return 1%MOD;
          else if(n%2==0)return modularExponentiation(modularMultiplication(x,x,MOD),n/2,MOD);
          else return modularMultiplication(x,modularExponentiation(modularMultiplication(x,x,MOD),(n-1)/2,MOD),MOD);
      }
      public long modularExponentiation(long x,long n,long MOD){
          long result=1;
          while(n>0){
              if(n%2==1)result=modularMultiplication(result,x,MOD);
              x=modularMultiplication(x,x,MOD);
              n/=2;
          }
          return result;
      }

      /**
       * Factorial of a number
       */
      public long factorials(long n){
          if(n==0)return 1;
          return n*factorials(n-1);
      }

      /**
       * Prime factors of a number
       */
      public ArrayList<Integer> distinctPrimeFactors(int n){
          ArrayList<Integer> factorials=new ArrayList<>();
          int limit=(int)Math.sqrt(n);
          if(n%2==0){
              factorials.add(2);
              while(n%2==0)n/=2;
          }
          for(int i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Long> distinctPrimeFactors(long n){
          ArrayList<Long> factorials=new ArrayList<>();
          long limit=(long)Math.sqrt(n);
          if(n%2==0){
              factorials.add((long)2);
              while(n%2==0)n/=2;
          }
          for(long i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Integer> primeFactors(int n){
          ArrayList<Integer> factorials=new ArrayList<>();
          int limit=(int)Math.sqrt(n);
          if(n%2==0){
              factorials.add(2);
              while(n%2==0)n/=2;
          }
          for(int i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      public ArrayList<Long> primeFactors(long n){
          ArrayList<Long> factorials=new ArrayList<>();
          long limit=(long)Math.sqrt(n);
          if(n%2==0){
              factorials.add((long)2);
              while(n%2==0)n/=2;
          }
          for(long i=3;i<=limit;i+=2){
              if(n%i==0){
                  factorials.add(i);
                  while(n%i==0)n/=i;
              }
          }
          if(n>2)factorials.add(n);
          return factorials;
      }

      /**
       * Combination: nCr
       */
      //Naive version
      //(n,r)=(n-1,r-1)+(n-1,r) for r!=0 or r!=n
      //(n,0)=(n,n)=1
      public int binomialCoefficientRecursive(int n,int k){
          if(k==0 || k==n)return 1;//base case
          return binomialCoefficientRecursive(n-1,k-1)+binomialCoefficientRecursive(n-1,k);//recursion
      }

      //Dynamic Programming version(Uses bottom up approach to fill the table)
      //Time complexity: O(n*k)
      //Space complexity: O(n*k)
      public long binomialCoefficientIterative(int n,int k){
          long[][] C=new long[n+1][k+1];
          for(int i=0;i<=n;++i){
              for(int j=0;j<=Math.min(n,k);++j){
                  if(j==0 || j==i)C[i][j]=1;
                  else C[i][j]=C[i-1][j-1]+C[i-1][j];
              }
          }
          return C[n][k];
      }

      //Pascal's Triangle version(Space efficient program)
      //Time complexity: O(n*k)
      //Space complexity: O(k)
      public long nCr(int n,int r){
          int[] C=new int[r+1];
          C[0]=1;//nC0=1
          for(int i=1;i<=n;++i)
              for(int j=Math.min(i,r);j>0;--j)
                  C[j]=C[j]+C[j-1];
          return C[r];
      }

      /**
       * Catlan number:
       *  - Time complexity: O(n*n)
       *  - Auxiliary space: O(n)
       *
       *  NOTE: Time complexity could be reduced to O(n) but it is
       *        possible if and only if n is small or else there is
       *        a chance of getting an overflow. To decrease the time
       *        complexity to O(n) just remember nCr=nCn-r
       */
      public long catlanNumber(int n){
          long[] catlan=new long[n+1];
          catlan[0]=catlan[1]=1;
          for(int i=2;i<=n;++i)
              for(int j=0;j<i;++j)
                  catlan[i]+=catlan[j]*catlan[i-1-j];

          return catlan[n];
      }

      /**
       * Greatest Common Divisor(GCD)
       *  - It is also known as Highest Common Factor(HCF)
       *  - Time complexity: log(min(a,b))
       *  - Auxiliary Space: O(1)
       */
      public int gcd(int a,int b){
          if(b==0)return a;
          return gcd(b,a %b);
      }

      public long gcd(long a,long b){
          if(b==0)return a;
          return gcd(b,a%b);
      }

      /**
       * Extended Euclid's Algorithm:
       *  - ax+by=gcd(a,b)
       *  - Time complexity:
       *  -
       */

      /**
       * Least Common Multiple(LCM):
       *  - Time complexity: log(min(a,b))
       *  - Auxiliary Space: O(1)
       */
      public long lcm(long a,long b){
          return (a*b)/gcd(a,b);
      }

  }
}
//
//                       "8,        .m8"
//                        I8Im    ,mI8"
//                        ,8I""I8,mI8m
//             "I8mm,    ,I8    I8 "I8,          ,m"
//                "I88I88I8m ,I8"   "I8""==mm ,mI8"
//        ___    ,mI8"    "8I8"      I8,  ,mI8I8"
//   .,mI8I8I8I8I88,      ,m8"      ,I8I8I8I888"
// "I8Im,       "I88,    ,8"      ,II8"     "88,
//    `"I8,        "I8, ,8"     ,I8"         "I8,
//       "I8m       "I888      ,I8"           "I8,
//         "8m        "I8      88"              "I8,
//          I8,        I8      88                 "I8,
//           88,       I8,     "I8                 "I8
//           "I8,      "I8,     "I8,                I8;.
//            "I8,      "I8,      "I8        .,mmmI8888888m,.
//              I8,      "I8,      I8,  .mI8I88"""". .. "I8888
//              "I8,      "I8      mI8I88"". . . . . .,m8"   "8
//               I8m,  __ ;I8   ,II88" . . . . .,;miI88"
//               "I88I8I88I88,,I88" . . . ,mmiiI8888"
//                ,I8". . ."I8I8". . . mi888888888"
//              ,I8 . . . .,I88I. . .i88888888888"
//             I8. . . .,mII88Ima. .i88888888888"
//            ,8"..,mI88I88I88I8Imi888888888888"
//            I8.,I8I"""        ""II88888888888
//           ;I8I8"                  ""I8888888
//           ""                         "I88888
//                                        "I888
//                                         "I88,
//                                          "I88
//                                           "88,
//                                            I88,              ______   __
//                           ______           "I88__        .mI88I88I88I88I88,
//                      .,mI88I88I88, ,mI88,   I88"""     ,mI8". . . . "I8,..8,
//                    ,I888' . . . "I88.\ "8,  I88      ,I8". . . .  / :;I8 \ 8,
//                  .mI8' . . .  / .:"I8.\ 88  "88,    ,8". . .  / .;mI8I8I8,\ 8
//                 ,I8'. . .  / . .:;,I8I8I888  I88   ,8". .  / .:mI8"'   "I8,:8
//                ,I8'. . . / . .:;,mI8"  `"I88 I88   I8. .  / .m8"         "I8I
//               ,I8 . .  / . .:;,mI8"      "I88888   88,.  / ,m8            "8'
//               I8'. .  / . .;,mI8"          "II888 ,I8I8,.,I8"
//               I8 . . / . .,mI8"              I8888888' """
//               `I8,.  / ;,mI8"                 II888
//                "I8I, /,mI8"                 __I888
//                  "I8888"                   """I88
//                    ""                         I88
//                                               I88__
//                                               I88"""
//                                               I88
//                                               I88
//                                             __I88
//                                            """I88
//                                               I88
//                                               I88
//                                               I88__
//                                               I88"""
//                                               I88
//                                        BITSY  ___  CHUCK

import java.io.*;
import java.math.*;
import java.util.*;

public class Main
{
    static Input in;
    static Output out;
    //static final boolean OJ = System.getProperty("MY_FLAG") == null;

    public static void main(String[] args) throws IOException
    {
        System.exit(0);
    }

    private static void run() throws IOException
    {
        int[][] state = new int[3][3];
        for (int i = 0; i < 3; i++) Arrays.fill(state[i], 1);

        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
            {
                int p = in.nextInt();
                for (int k = 0; k < p; k++)
                    toggle(i, j, state);
            }

        for (int i = 0; i < 3; i++, out.println(""))
            for (int j = 0; j < 3; j++)
                out.print(state[i][j]);
    }

    private static void toggle(int i, int j, int[][] state)
    {
        state[i][j] ^= 1;

        if (i + 1 < 3) state[i + 1][j] ^= 1;

        //if (i + 1 < 3 && j + 1 < 3) state[i + 1][j + 1] ^= 1;

        if (j + 1 < 3) state[i][j + 1] ^= 1;

        //if (i - 1 >= 0 && j + 1 < 3) state[i - 1][j + 1] ^= 1;

        if (i - 1 >= 0) state[i - 1][j] ^= 1;

        //if (i - 1 >= 0 && j - 1 >= 0) state[i - 1][j - 1] ^= 1;

        if (j - 1 >= 0) state[i][j - 1] ^= 1;

        //if (i + 1 < 3 && j - 1 >= 0) state[i + 1][j - 1] ^= 1;
    }
}

class Input
{
    final int SIZE = 8192;
    private InputStream in;
    private byte[] buf = new byte[SIZE];
    private int last, current, total;

    public Input(InputStream stream) throws IOException
    {
        in = stream;
        last = read();
    }

    private int read() throws IOException
    {
        if (total == -1) throw new EOFException();
        if (current >= total)
        {
            current = 0;
            total = in.read(buf);
            if (total <= 0) return -1;
        }
        return buf[current++];
    }

    private void advance() throws IOException
    {
        while (true)
        {
            if (last == -1) return;
            if (!isValidChar(last)) last = read();
            else break;
        }
    }

    private boolean isValidChar(int c)
    {
        return c > 32 && c < 127;
    }

    public boolean isEOF() throws IOException
    {
        advance();
        return last == -1;
    }

    public String nextString() throws IOException
    {
        advance();
        if (last == -1) throw new EOFException();
        StringBuilder s = new StringBuilder();
        while (true)
        {
            s.appendCodePoint(last);
            last = read();
            if (!isValidChar(last)) break;
        }
        return s.toString();
    }

    public String nextLine() throws IOException
    {
        if (last == -1) throw new EOFException();
        StringBuilder s = new StringBuilder();
        while (true)
        {
            s.appendCodePoint(last);
            last = read();
            if (last == '\n' || last == -1) break;
        }
        return s.toString();
    }

    public String nextLine(boolean ignoreIfEmpty) throws IOException
    {
        if (!ignoreIfEmpty) return nextLine();
        String s = nextLine();
        while (s.trim().length() == 0) s = nextLine();
        return s;
    }

    public int nextInt() throws IOException
    {
        advance();
        if (last == -1) throw new EOFException();
        int n = 0, s = 1;
        if (last == '-')
        {
            s = -1;
            last = read();
            if (last == -1) throw new EOFException();
        }
        while (true)
        {
            n = n * 10 + last - '0';
            last = read();
            if (!isValidChar(last)) break;
        }
        return n * s;
    }

    public long nextLong() throws IOException
    {
        advance();
        if (last == -1) throw new EOFException();
        int s = 1;
        if (last == '-')
        {
            s = -1;
            last = read();
            if (last == -1) throw new EOFException();
        }
        long n = 0;
        while (true)
        {
            n = n * 10 + last - '0';
            last = read();
            if (!isValidChar(last)) break;
        }
        return n * s;
    }

    public BigInteger nextBigInt() throws IOException
    {
        return new BigInteger(nextString());
    }

    public char nextChar() throws IOException
    {
        advance();
        return (char) last;
    }

    public double nextDouble() throws IOException
    {
        advance();
        if (last == -1) throw new EOFException();
        int s = 1;
        if (last == '-')
        {
            s = -1;
            last = read();
            if (last == -1) throw new EOFException();
        }
        double n = 0;
        while (true)
        {
            n = n * 10 + last - '0';
            last = read();
            if (!isValidChar(last) || last == '.') break;
        }
        if (last == '.')
        {
            last = read();
            if (last == -1) throw new EOFException();
            double m = 1;
            while (true)
            {
                m = m / 10;
                n = n + (last - '0') * m;
                last = read();
                if (!isValidChar(last)) break;
            }
        }
        return n * s;
    }

    public BigDecimal nextBigDecimal() throws IOException
    {
        return new BigDecimal(nextString());
    }

    public void close() throws IOException
    {
        in.close();
        in = null;
    }

}

class Output
{
    final int SIZE = 8192;
    private Writer out;
    private char cb[] = new char[SIZE];
    private int nChars = SIZE, nextChar = 0;
    private char lineSeparator = '\n';

    public Output(OutputStream stream)
    {
        out = new OutputStreamWriter(stream);
    }

    void flushBuffer() throws IOException
    {
        if (nextChar == 0) return;
        out.write(cb, 0, nextChar);
        nextChar = 0;
    }

    void write(int c) throws IOException
    {
        if (nextChar >= nChars) flushBuffer();
        cb[nextChar++] = (char) c;
    }

    void write(String s, int off, int len) throws IOException
    {
        int b = off, t = off + len;
        while (b < t)
        {
            int a = nChars - nextChar, a1 = t - b;

            int d = a < a1 ? a : a1;
            s.getChars(b, b + d, cb, nextChar);
            b += d;
            nextChar += d;
            if (nextChar >= nChars) flushBuffer();
        }
    }

    void write(String s) throws IOException
    {
        write(s, 0, s.length());
    }

    public void print(Object obj) throws IOException
    {
        write(String.valueOf(obj));
    }

    public void println(Object obj) throws IOException
    {
        write(String.valueOf(obj));
        write(lineSeparator);
    }

    public void printf(String format, Object... obj) throws IOException
    {
        write(String.format(format, obj));
    }

    public void close() throws IOException
    {
        flushBuffer();
        out.flush();
        out.close();
        out = null;
    }
}

import java.util.Scanner;
public class free{
public static void main(String  args[]){
Scanner sc=new Scanner(System.in);
int on[][]=new int[3][3];
int lights[][]=new int[3][3];
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
on[i][j]=1;
lights[i][j]=sc.nextInt();
if(lights[i][j]%2==0){
lights[i][j]=0;
}
else{
lights[i][j]=1;
}

}

}

for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(lights[i][j]==1){
toggle(on,i,j);
}

}

}

for(int i=0;i<3;i++){
	for(int j=0;j<3;j++){
		System.out.print(on[i][j]+ " " );
	}
	System.out.println();
}

}

static void toggle(int[][]x,int y,int z){
  palat(x,y,z);

        if(z>=1){
		palat(x,y,z-1);
		}
		if(z<2){
		palat(x,y,z+1);
		}
		if(y>=1){
		palat(x,y-1,z);
		}
		if(y<2){
		palat(x,y+1,z);
		}

		}

		static void palat(int x[][],int y,int z){
		if(x[y][z]==0){
		x[y][z]=1;
		}
		else if(x[y][z]==1){
		x[y][z]=0;
		}
		}

}

import java.util.*;
public class Main
{
    public static void main(String args[])
    {
        int n;
        Scanner sc=new Scanner(System.in);
        boolean arr[][]=new boolean[5][5];
        // false means on and true means off
        for(int i=1;i<=3;i++)
        {
            for (int j=1;j<=3;j++) {
                n=sc.nextInt();
                if (n%2!=0) {
                    arr[i][j]=!arr[i][j];
                    arr[i][j+1]=!arr[i][j+1];
                    arr[i][j-1]=!arr[i][j-1];
                    arr[i-1][j]=!arr[i-1][j];
                    arr[i+1][j]=!arr[i+1][j];
                }
            }
        }
        for(boolean[] x:arr)
        {
            for(boolean y:x)
            {
                if (y)
                    System.out.print(0);
                else
                    System.out.print(1);
            }
            System.out.println();
        }
    }
}

import java.util.Scanner;

public class lightsOut {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int [][]lights = {{1,1,1},{1,1,1},{1,1,1}};
        int [][]input =new int[3][3];
        for (int i = 0; i<input[0].length; i++){
            for(int j =0; j<input.length; j++){
                input[j][i]=in.nextInt();
            }
        }
        for (int i = 0; i<input[0].length; i++){
            for(int j =0; j<input.length; j++){
                if(input[j][i]%2==1){
                    lights[j][i]=lights[j][i]==1?0:1;
                    if(i<2)
                        lights[j][i+1]=lights[j][i+1]==1?0:1;
                    if(i>0)
                        lights[j][i-1]=lights[j][i-1]==1?0:1;
                    if(j<2)
                        lights[j+1][i]=lights[j+1][i]==1?0:1;
                    if(j>0)
                        lights[j-1][i]=lights[j-1][i]==1?0:1;
                }
            }
            System.out.println();
        }

        for (int i = 0; i<input[0].length; i++){
            for(int j =0; j<input.length; j++){
                System.out.print(lights[j][i]);
            }
            System.out.println();
        }
    }
}

import java.util.Scanner;
import java.util.Arrays;
public class LightsOut{
public static int switches[][] = new int[3][3];
public static void main(String []args){
Scanner s = new Scanner(System.in);
for(int[] row : switches)
 Arrays.fill(row, 1);
int i = 0;
int j;
while(i < 3)
{
 j = 0;
while(j < 3){
int r = s.nextInt();
if(r > 0)
 Updategrid(i, j, r);
j++;
}
i++;
}
switches[1][1] = 1;
draw();
}
private static void draw()
{
    int i, j;
    for(i = 0; i < 3; ++i){
         for(j = 0; j< 3; ++j)
          System.out.print(switches[i][j]);
        System.out.println();
    }
    System.out.println();
        }
private static void Updategrid(int i ,int j, int k)
{
int minx = (i - 1) < 0 ? 0 : i - 1;
int maxx = (i + 2) > 2 ? 3: i + 2;
int miny = (j - 1) < 0 ? 0 : j - 1;
int maxy = (j + 2) > 2 ? 3: j + 2;
 for(i = minx;i < maxx;++i)
 {
 for(j = miny; j < maxy;++j){
 if(switches[i][j] == 1 && k % 2 == 1)
   switches[i][j] = 0;
 else if(switches[i][j] == 0 && k % 2 == 1)
     switches[i][j] = 1;
}

}

}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
	public static void main(String[] args) throws IOException
	{	int xA []={0, 1, 1, 0,-1,-1,-1, 0, 1};
		int yA []={0, 0, 1, 1, 1, 0,-1,-1,-1};
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		int in [][] = new int [3][3];int outp [][]= new int [3][3];
		for(int i=0;i<3;i++)
		{	String line []=br.readLine().split(" ");
			for(int j=0;j<3;j++)
			{
				in[i][j]=Integer.parseInt(line[j]);
				outp[i][j]=1;
			}

		}

		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
			{
				if(in[i][j]%2!=0)
				{
					for(int k=0;k<8;k++)
					{
						int x =xA[k]+j;
						int y =yA[k]+i;
						if(x<0||x>2)
							continue;
						if(y<0||y>2)
							continue;
						outp[y][x]=1-outp[y][x];
					}
				}
			}
		StringBuilder sb = new StringBuilder("");
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{

				sb.append(outp[i][j]);
			}
			sb.append("\n");

		}
		System.out.println(sb.toString());
	}
}

import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int[][] arr=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                arr[i][j]=sc.nextInt();
                if(arr[i][j]%2!=0)arr[i][j]=1;
                else arr[i][j]=0;
            }
        }
        int[][] res=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                res[i][j]=1;
            }
        }

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(arr[i][j]==1){
                 res[i][j]=(res[i][j]+1)%2;
                 if(i>=1)res[i-1][j]=(res[i-1][j]+1)%2;
                 if(i<2)res[i+1][j]=(res[i+1][j]+1)%2;
                 if(j>=1)res[i][j-1]=(res[i][j-1]+1)%2;
                 if(j<2)res[i][j+1]=(res[i][j+1]+1)%2;
                }
            }
        }
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++)System.out.print(res[i][j]+" ");
            System.out.println();
        }

    }
}

import java.util.Scanner;

public class A {

    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);
        int i=0, j=0, k=0;
        boolean[][] l = new boolean[][]{{true,true,true},
                {true,true,true},
                {true,true,true}
        };

        for(i=0; i<3; i++){
            for(j=0; j<3; j++){
                k = r.nextInt();
                if(k%2!=0){
                    l[i][j] = !l[i][j];
                    if(i+1<3){
                        l[i+1][j] = !l[i+1][j];
                    }
                    if(i-1>0){
                        l[i-1][j] = !l[i-1][j];
                    }
                    if(j+1<3){
                        l[i][j+1] = !l[i][j+1];
                    }
                    if(j-1>0){
                        l[i][j-1] = !l[i][j-1];
                    }
                }
            }

        }

        for(i=0; i<3; i++){
            for(j=0; j<3; j++){
                if(l[i][j]){
                    System.out.print("1 ");
                }else{
                    System.out.print("0 ");
                }
            }
            System.out.print("\n");
        }
    }

}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

    InputStream is;
	PrintWriter out;
        String INPUT ="1 0 1\n" +
"8 8 8\n" +
"2 0 3";

        void solve()
	{

        }

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

    public static void main(String[] args) throws Exception { new Solution().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c)
        { return !(c >= 33 && c <= 126); }
	private int skip()
        { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd()//whole line double
        { return Double.parseDouble(ns()); }
	private char nc()//char
        { return (char)skip(); }

	private String ns()//String
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)//char[n]
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)// char[n][m]
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)//array
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()//int
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()//long
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * User: dima
 * Date: 20.02.13
 * Time: 18:54
 * To change this template use File | Settings | File Templates.
 */
public class TaskA {
    public static int[] mi = {0, -1, 1, 0, 0};
    public static int[] mj = {1, 0, 0, -1, 0};
    static BufferedReader in = new BufferedReader(new InputStreamReader(
            System.in));
    static StringTokenizer str;
    static String SK;

    static String next() throws IOException {
        while ((str == null) || (!str.hasMoreTokens())) {
            SK = in.readLine();
            if (SK == null)
                return null;
            str = new StringTokenizer(SK);
        }
        return str.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static int[][] made(int i, int j, int[][] t) {
        for (int ii = 0; ii < 5; ii++) {
            if (i + mi[ii] >= 3 || i + mi[ii] < 0) continue;
            if (j + mj[ii] >= 3 || j + mj[ii] < 0) continue;
            if (t[i + mi[ii]][j + mj[ii]] == 1) t[i + mi[ii]][j + mj[ii]] = 0;
            else t[i + mi[ii]][j + mj[ii]] = 1;
        }
        return t;
    }

    public static void main(String[] args) throws IOException {
        int[][] inin = new int[3][3];
        int[][] out = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                out[i][j] = 1;
                inin[i][j] = nextInt();
                inin[i][j] = inin[i][j] % 2;
            }
        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int cnt = inin[i][j];
                for (int ii = 0; ii < cnt; ii++) {
                    out = made(i, j, out);
                }
            }
        }

        String answ = "";
        for (int i = 0; i < 3; i++) {

            for (int j = 0; j < 3; j++) {
                answ += out[i][j];
            }
            System.out.println(answ);
        }

    }
}

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int[] dx = {-1, 1, 0, 0};
        int[] dy = {0, 0, -1, 1};
        int n = 3;
        int[][] t = new int[n][n];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                t[i][j] = s.nextInt()%2;
            }
        }

        int[][] res = new int[n][n];
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++) res[i][j] = 1;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                for(int ii = 0; ii < t[i][j]; ii++) {
                    res[i][j] = res[i][j] ^ 1;
                    for(int k = 0; k < 4; k++) {
                        int nx = dx[k]+i;
                        int ny = dy[k]+j;
                        if(nx < 0 || ny < 0 || nx >= 3 || ny >= 3) continue;
                        res[nx][ny] = res[nx][ny] ^ 1;
                    }
                }
            }
        }
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if(j > 0) System.out.print(" ");
                System.out.print(res[i][j]);
            }
            System.out.println();
        }
    }
}

import java.util.*;
import java.io.*;
public class solution{
    public static void main(String [] args){
        Scanner sc=new Scanner(System.in);
        int [][]temp=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                int x=sc.nextInt();
                if(i-1>=0) temp[i-1][j]+=x;
                if(i+1<3) temp[i+1][j]+=x;
                if(j+1<3) temp[i][j+1]+=x;
                if(j-1>=0) temp[i][j-1]+=x;
            }
        }
        int [][]res=new int[3][3];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(temp[i][j]%2==0) System.out.println("1");
                else System.out.print("0");
            }
            System.out.println();
        }
    }
}

import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[][] b = new int[3][3];
        int[][] a = new int[3][3];
        for (int i = 0; i < b.length; i++)
            for (int j = 0; j < b.length; j++)
                b[i][j] = scan.nextInt();
        for (int i = 0; i < b.length; i++)
            for (int j = 0; j < b.length; j++)
                a[i][j] = 1;
        for (int i = 0; i < a.length; i++)
            for (int j = 0; j < a.length; j++)
                if (b[i][j] % 2 != 0) {
                    a[i][j] = (a[i][j] == 0) ? 1 : 0;
                    if (i + 1 < a.length) {
                        a[i + 1][j] = (a[i + 1][j] == 0) ? 1 : 0;
                    }
                    if (j + 1 < a.length) {
                        a[i][j + 1] = (a[i][j + 1] == 0) ? 1 : 0;
                    }
                    if (i - 1 >= 0) {
                        a[i - 1][j] = (a[i - 1][j] == 0) ? 1 : 0;
                    }
                    if (j - 1 >= 0) {
                        a[i][j - 1] = (a[i][j - 1] == 0) ? 1 : 0;
                    }

                }
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                System.out.print(a[i][j] + " ");
            }

            System.out.println();
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class lightout
{
    //By shwetank_verma
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static int mod=1000000007;
    static boolean primes[]=new boolean[1000007];

    static boolean seive(int n){
        Arrays.fill(primes,true);
        primes[0]=primes[1]=false;
        for(int i=2;i*i<=n;i++){
            if(primes[i]==true){
                for(int p=i*i;p<=n;p+=i){
                    primes[p]=false;
                }
            }
        }
        if(n<1000007){
            return primes[n];
        }
        return false;

    }
    static int gcd(int a,int b){
        if(b==0)
        return a;
        return gcd(b,a%b);
    }
    static long GCD(long a,long b){
        if(b==0)
        return a;
        return GCD(b,a%b);
    }

    public static void main(String[] args)
    {
        FastReader sc=new FastReader();
        try{

                int a[][]=new int[3][3];
                for(int i=0;i<3;i++){
                	for(int j=0;j<3;j++)
                    a[i][j]=sc.nextInt();
                }
                int p=a[0][0]+a[0][1]+a[1][0];
                int q=a[0][1]+a[0][0]+a[0][2]+a[1][1];
               int r= a[0][2]+a[0][1]+a[1][2];
               System.out.println((1-p%2)+""+(1-q%2)+""+(1-r%2));
               int s= a[1][0]+a[0][0]+a[1][1]+a[2][0];
                int t=a[1][1]+a[1][0]+a[1][2]+a[0][1]+a[2][1];
               int u= a[1][2]+a[1][1]+a[0][2]+a[2][2];
               System.out.println((1-s%2)+""+(1-t%2)+""+(1-q%2));
               int v= a[2][0]+a[1][0]+a[2][1];
               int w= a[2][1]+a[2][0]+a[2][2]+a[1][1];
               int x= a[2][2]+a[2][1]+a[1][2];
               System.out.println((1-v%2)+""+(1-w%2)+""+(1-x%2));

        }catch(Exception e){
            return;
        }
    }
}

// Working program with FastReader
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Main
{
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

    static void toggle(int i, int j, int x[][], int n)
    {
        if(n==0)
        return;
        else
        {
            int mod=x[i][j];
            for(int m=0;m<3;m++)
            {
                mod = x[i][m];
                x[i][m]=1-mod;
            }
            for(int m=0;m<3;m++)
            {
                mod = x[m][j];
                x[m][j]=1-mod;
            }
            toggle(i,j,x,n-1);
        }
    }
	public static void main(String[] args)
	{
		FastReader s=new FastReader();
		int x[][]=new int[3][3];
		int y[][]=new int[3][3];

		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        x[i][j]=1;
		         y[i][j]=s.nextInt();
		    }
		}

    	for(int i=0;i<3;i++)
    	{
    	    for(int j=0;j<3;j++)
    	    {
    	        toggle(i,j,x,y[i][j]);
    	    }
    	}

		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        System.out.print(x[i][j]);
		    }
		    System.out.println("");
		}
	}
}

import java.util.Scanner;

public class ALightsOut {

	public int callNum(int lights) {
		if (lights == 0) {
			return 1;
		} else {
			return 0;
		}
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int[][] lights = { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };

		ALightsOut a = new ALightsOut();

		for (int i = 0; i < lights.length; i++) {
			for (int j = 0; j < lights.length; j++) {

				int input = scan.nextInt();

				if (input % 2 == 0) {
					continue;
				} else {

					if (i == 0) {
						if (j == 0) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j + 1] = a.callNum(lights[i][j + 1]);
							lights[i + 1][j] = a.callNum(lights[i + 1][j]);
						}

						if (j == 1) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j + 1] = a.callNum(lights[i][j + 1]);
							lights[i][j - 1] = a.callNum(lights[i][j - 1]);
							lights[i + 1][j] = a.callNum(lights[i + 1][j]);
						}

						if (j == 2) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j - 1] = a.callNum(lights[i][j - 1]);
							lights[i + 1][j] = a.callNum(lights[i + 1][j]);
						}
					}

					if (i == 1) {
						if (j == 0) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j + 1] = a.callNum(lights[i][j + 1]);
							lights[i - 1][j] = a.callNum(lights[i - 1][j]);
							lights[i + 1][j] = a.callNum(lights[i - 1][j]);
						}

						if (j == 1) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j + 1] = a.callNum(lights[i][j + 1]);
							lights[i][j - 1] = a.callNum(lights[i][j - 1]);
							lights[i + 1][j] = a.callNum(lights[i + 1][j]);
							lights[i - 1][j] = a.callNum(lights[i - 1][j]);
						}

						if (j == 2) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j - 1] = a.callNum(lights[i][j - 1]);
							lights[i + 1][j] = a.callNum(lights[i + 1][j]);
							lights[i - 1][j] = a.callNum(lights[i - 1][j]);
						}
					}

					if (i == 2) {
						if (j == 0) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j + 1] = a.callNum(lights[i][j + 1]);
							lights[i - 1][j] = a.callNum(lights[i - 1][j]);
						}

						if (j == 1) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j + 1] = a.callNum(lights[i][j + 1]);
							lights[i][j - 1] = a.callNum(lights[i][j - 1]);
							lights[i - 1][j] = a.callNum(lights[i - 1][j]);
						}

						if (j == 2) {
							lights[i][j] = a.callNum(lights[i][j]);
							lights[i][j - 1] = a.callNum(lights[i][j - 1]);
							lights[i - 1][j] = a.callNum(lights[i - 1][j]);
						}
					}
				}
			}
		}

	for (int i = 0; i < lights.length; i++) {
		for (int j = 0; j < lights[i].length; j++) {
			System.out.print(lights[i][j]);
		}
		System.out.println();
	}
	scan.close();
}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        // write your code her
        // Main m = new Main();

        //////// Code Begins //////////////////////////
        Scanner sc = new Scanner(System.in);
        boolean [][] res = new boolean[3][3];
        for(int i=0;i<3;i++){
        	for(int j=0;j<3;j++){
        	int tmp = sc.nextInt();
        		if(tmp%2 == 0)
        			continue;

        		if(i != 0){
        			res[i-1][j] = !res[i-1][j];
        		}
        		if(i != 2){
        			res[i+1][j] = !res[i+1][j];
        		}
        		if(j != 0){
        			res[i][j-1] = !res[i][j-1];
        		}
        		if(j != 2){
        			res[i][j+1] = !res[i][j+1];
        		}
        	}
        }
        for(int i=0;i<3;i++){
        	for(int j=0;j<3;j++){
        		if(!res[i][j])
        			System.out.print("1 ");
        		else
        			System.out.print("0 ");
        	}
        	System.out.println();
        }
        //////// Code Ends ///////////////////////////////
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;

public class LightsOut {
	public static List<Integer> lista=new LinkedList<>();
	public static void main(String[] args) throws IOException {
		BufferedReader br= new BufferedReader(new InputStreamReader(System.in));

		for(int i=0; i<3; i++) {
			String s=br.readLine();
			StringTokenizer st = new StringTokenizer(s);
			 while (st.hasMoreTokens()) {
		         lista.add(Integer.valueOf(st.nextToken()));
		     }
		}
		kiir(paros(0));
		kiir(paros(1));
		kiir(paros(2));
		System.out.println();
		kiir(paros(3));
		kiir(paros(4));
		kiir(paros(5));
		System.out.println();
		kiir(paros(6));
		kiir(paros(7));
		kiir(paros(8));
	}
	public static boolean paros(int e) {
		int sum=0;
		List<Integer> l=szomszedos(e);
		for(int i=0; i< l.size(); i++) {
			sum+= lista.get(l.get(i));
			}
		if (sum==0) return false;
		return (sum%2==0) ? true : false;
	}
	public static List<Integer> szomszedos(int i) {
		if(i==0)  return Arrays.asList(0,1,3);
		if(i==1)  return Arrays.asList(1,0,2,4);
		if(i==2)  return Arrays.asList(2,1,5);
		if(i==3)  return Arrays.asList(0,3,4,6);
		if(i==4)  return Arrays.asList(1,3,4,5,7);
		if(i==5)  return Arrays.asList(2,4,5,8);
		if(i==6)  return Arrays.asList(3,6,7);
		if(i==7)  return Arrays.asList(7,6,4,8);
		if(i==8)  return Arrays.asList(8,7,5);
		return Arrays.asList(1,2);
	}
	public static void kiir(boolean b) {
		System.out.print(b ?  1 : 0);
	}
}

import java.util.*;
import java.io.*;
public class lightsout
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
        FastReader()
        {
            br=new BufferedReader(new InputStreamReader(System.in));
        }
        String next()
        {
            while(st==null||!st.hasMoreElements())
            {
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                    //TODO: handle exception
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }
    }
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        int toggle[][]=new int[3][3];
        int state[][]=new int[3][3];
        int i=0,j=0;int sum=0;
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
                toggle[i][j]=sc.nextInt();
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                sum=toggle[i][j];
                if(i<2)
                {
                    sum=sum+toggle[i+1][j];
                    if(j+1<3)
                    {
                        sum=sum+toggle[i+1][j+1];
                    }
                    if(j-1>=0)
                    {
                        sum=sum+toggle[i+1][j-1];
                    }
                }
                if(i>0)
                {
                    sum=sum+toggle[i-1][j];
                    if(j+1<3)
                    {
                        sum=sum+toggle[i-1][j+1];
                    }
                    if(j-1>=0)
                    {
                        sum=sum+toggle[i-1][j-1];
                    }
                }
                if(j<2)
                {
                    sum=sum+toggle[i][j+1];
                }
                if(j>0)
                {
                    sum=sum+toggle[i][j-1];
                }
                //System.out.println(sum);
                if(sum%2==0)
                {
                    state[i][j]=1;
                }
                else
                {
                    state[i][j]=0;
                }
            }
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            System.out.print(state[i][j]+" ");
            System.out.println();
        }

    }
}

// Working program with FastReader
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Main
{
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

    static void toggle(int i, int j, int x[][], int n)
    {
        if(n==0)
        return;
        else
        {
            int mod=x[i][j];
            for(int m=0;m<3;m++)
            {
                mod = x[i][m];
                x[i][m]=1-mod;
            }
            for(int m=0;m<3;m++)
            {
                mod = x[m][j];
                if(m!=i)
                x[m][j]=1-mod;
            }
            toggle(i,j,x,n-1);
        }
    }
	public static void main(String[] args)
	{
		FastReader s=new FastReader();
		int x[][]=new int[3][3];
		int y[][]=new int[3][3];

		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        x[i][j]=1;
		         y[i][j]=s.nextInt();
		    }
		}

    	for(int i=0;i<3;i++)
    	{
    	    for(int j=0;j<3;j++)
    	    {
    	        toggle(i,j,x,y[i][j]);
    	    }
    	}

		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        System.out.print(x[i][j]);
		    }
		    System.out.println("");
		}
	}
}

import java.util.*;
import java.io.*;
public class lightsout
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
        FastReader()
        {
            br=new BufferedReader(new InputStreamReader(System.in));
        }
        String next()
        {
            while(st==null||!st.hasMoreElements())
            {
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                    //TODO: handle exception
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }
    }
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        int toggle[][]=new int[3][3];
        int state[][]=new int[3][3];
        int i=0,j=0;int sum=0;
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
                toggle[i][j]=sc.nextInt();
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                sum=toggle[i][j];
                if(i<2)
                {
                    sum=sum+toggle[i+1][j];
                    if(j+1<3)
                    {
                        sum=sum+toggle[i+1][j+1];
                    }
                    if(j-1>=0)
                    {
                        sum=sum+toggle[i+1][j-1];
                    }
                }
                if(i>0)
                {
                    sum=sum+toggle[i-1][j];
                    if(j+1<3)
                    {
                        sum=sum+toggle[i-1][j+1];
                    }
                    if(j-1>=0)
                    {
                        sum=sum+toggle[i-1][j-1];
                    }
                }
                if(j<2)
                {
                    sum=sum+toggle[i][j+1];
                }
                if(j>0)
                {
                    sum=sum+toggle[i][j-1];
                }
                System.out.println(sum);
                if(sum%2==0)
                {
                    state[i][j]=1;
                }
                else
                {
                    state[i][j]=0;
                }
            }
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            System.out.print(state[i][j]+" ");
            System.out.println();
        }

    }
}

import java.util.Scanner;
public class Robo3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = 3;
        int a[][] = new int[n][n];
        int ans[][] = new int[n][n];
        for (int i=0; i<3; i++) {
            for (int j=0; j<3; j++) {
                a[i][j] = in.nextInt();
                ans[i][j] = ans[i][j] + a[i][j];
                if (i-1>=0) ans[i-1][j] = ans[i-1][j] + a[i][j];
                if (j-1>=0) ans[i][j-1] = ans[i][j-1] + a[i][j];
                if (i+1<3) ans[i+1][j] = ans[i+1][j] + a[i][j];
                if (j+1<3) ans[i][j+1] = a[i][j+1] + a[i][j];
            }
        }
        for (int i=0;i<3;i++) {
            for (int j=0;j<3;j++) {
                ans[i][j] = ans[i][j] %2;
                if (ans[i][j] == 0) ans[i][j] = 1;
                else ans[i][j] = 0;
                System.out.print(ans[i][j]+"");
            }
                System.out.println();
        }
    }
}

// Working program with FastReader
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;

public class Main1
{
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}

    static void toggle(int i, int j, int x[][], int n)
    {
        if(n==0)
        return;
        else
        {

            for(int m=0;m<3;m++)
            {
                    x[i][m]=1-x[i][m];
            }
            for(int m=0;m<3;m++)
            {
                if(m!=i)
                x[m][j]=1-x[m][j];
            }
            toggle(i,j,x,n-1);
        }
    }
	public static void main(String[] args)
	{
		FastReader s=new FastReader();
		int x[][]=new int[3][3];
		int y[][]=new int[3][3];

		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        x[i][j]=1;
		         y[i][j]=s.nextInt();
		    }
		}

    	for(int i=0;i<3;i++)
    	{
    	    for(int j=0;j<3;j++)
    	    {
    	        toggle(i,j,x,y[i][j]);
    	    }
    	}

		for(int i=0;i<3;i++)
		{
		    for(int j=0;j<3;j++)
		    {
		        System.out.print(x[i][j]);
		    }
		    System.out.println("");
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;

public class Task275A {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {
		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			BufferedReader br = new BufferedReader(new InputStreamReader(is));

			String lightstmp[][] = new String[3][];
			for (int i = 0; i < 3; i++) {
				lightstmp[i] = br.readLine().split(" ");
			}

			int lights[][] = new int[3][3];

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					lights[i][j] = 1;
				}
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					boolean zwitch = Integer.parseInt(lightstmp[i][j]) % 2 == 0;
					if (!zwitch)
						continue;
					lights[i][j] = 1 - lights[i][j];
					if (i > 0) {
						lights[i - 1][j] = 1 - lights[i - 1][j];
					}
					if (i < 2) {
						lights[i + 1][j] = 1 - lights[i + 1][j];
					}
					if (j > 0) {
						lights[i][j - 1] = 1 - lights[i][j - 1];
					}
					if (j < 2) {
						lights[i][j + 1] = 1 - lights[i][j + 1];
					}
				}
			}

			for (int i = 0; i < 3; i++) {
				os.write(("" + lights[i][0] + lights[i][1] + lights[i][2] + System.lineSeparator()).getBytes());
			}

		}
	}

}

import java.util.*;

public class LightsOut {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[][] lights = new int[5][5];
        int temp = 0;

        for (int i = 1; i < 3; i++)
            for (int j = 1; j < 3; j++) {
                int[] x = { -1, 0, 0, 0, 1 };
                int[] y = { 0, -1, 0, 1, 0 };
                temp = in.nextInt();
                for (int k = 0; k < 5; ++k)
                    lights[i + x[k]][j + y[k]] += temp;
            }

        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= 3; j++) {
                if (lights[i][j] % 2 == 0)
                    lights[i][j] = 1;
                else
                    lights[i][j] = 0;
                System.out.print(lights[i][j]);
            }
            System.out.println();
        }
        in.close();

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class code {

    public static void main(String[] args) throws IOException {
     Scanner k=new Scanner(System.in);
     int[][]array=new int[3][3];

     for (int i = 0; i < array.length; i++) {

         for (int j = 0; j < array.length; j++) {
                int x=k.nextInt();

                array[i][j]+=x;
                if (i-1>=0) {
                    array[i-1][j]+=x;

                }
                if (i+1<array.length) {
                    array[i+1][j]+=x;

                }
                if (j-1>=0) {
                    array[i][j-1]+=x;

                }
                if (j+1<array.length) {
                    array[i][j+1]+=x;

                }

            }

    }
     for (int i = 0; i < array.length; i++) {
          for (int j = 0; j < array.length; j++) {
            if (array[i][j]%2!=0) {
                System.out.print("0 ");
            }
            else {
                System.out.print("1 ");
            }
        }
          System.out.println();
     }

    }
}