import java.util.*;
import java.io.*;

public class Binairo
{
    
    public static int board_size;
    public static int[][] board;
    public static void main(String[] Args)
    {
        Scanner sc = new Scanner(System.in);
        
        // Read in the size of the board
        board_size = sc.nextInt();
        
        // Check for a valid board
        if (board_size % 2 != 0 || board_size < 1)
        {
            System.out.println("Please enter a valid board size");
            return;
        }
        
        // Initialize the board
        board = new int[board_size][board_size];
        
        // Read in the board
        for (int row = 0; row < board_size; row++)
        {
            for (int col = 0; col < board_size; col++)
            {
                board[row][col] = sc.nextInt();
            }
        }
        
        if (weCanSolve(board, 0, 0))
        {
            print(board);
        }
    }
    
    public static boolean weCanSolve(int[][] board, int curRow, int curCol)
    {
        // Prune for backtrack
        if (conflict(board))
        {
            return false;
        }
        
        // If we are at the end of the row move to next row
        if (curCol == board_size)
        {
            curCol = 0;
            curRow++;
        }
        
        // Everything is fine
        if (curRow >= board_size)
        {
            return true;
        }
        
        // Look for an empty cell
        while (board[curRow][curCol] != -1)
        {
            // Update the column
            curCol++;
            
            // Check if the column is outside the row
            if (curCol == board_size)
            {
                curCol = 0;
                curRow++;
            }
            
            // Everything is fine
            if (curRow >= board_size)
            {
                return true;
            }
        }
        
        board[curRow][curCol] = 0;
        if (weCanSolve(board, curRow, curCol + 1))
        {
            return true;
        }
        board[curRow][curCol] = 1;
        if (weCanSolve(board, curRow, curCol + 1))
        {
            return true;
        }
        
        // We didnt find a solution; you gave us garbage
        board[curRow][curCol] = -1;
        return false;
    }
    
    public static boolean conflict(int[][] board)
    {
        // Rule 1 equal zeros and ones
        for (int row = 0; row < board_size; row++)
        {
           int numZeros = 0;
           int numOnes = 0;
           for (int col = 0; col < board_size; col++)
           {
               if (board[row][col] == 0)
               {
                   numZeros++;
               }
               if (board[row][col] == 1)
               {
                   numOnes++;
               }
           }
           
           if (numZeros > board_size / 2)
           {
               return true;
           }
           if (numOnes > board_size / 2)
           {
               return true;
           }
        }
        
        // Check columns
        for (int col = 0; col < board_size; col++)
        {
           int numZeros = 0;
           int numOnes = 0;
           for (int row = 0; row < board_size; row++)
           {
               if (board[row][col] == 0)
               {
                   numZeros++;
               }
               if (board[row][col] == 1)
               {
                   numOnes++;
               }
           }
           
           if (numZeros > board_size / 2)
           {
               return true;
           }
           if (numOnes > board_size / 2)
           {
               return true;
           }
        }
        
        for (int row = 0; row < board_size; row++)
        {
            int similar = 1;
            for (int col = 1; col < board_size; col++)
            {
                if (board[row][col] == -1)
                    similar = 0;
                if (board[row][col] == board[row][col - 1])
                {
                    similar++;
                }
                else
                {
                    similar = 1;
                }
                if (similar == 3)
                {
                    return true;
                }
            }
        }
        for (int col = 0; col < board_size; col++)
        {
            int similar = 1;
            for (int row = 1; row < board_size; row++)
            {
                if (board[row][col] == -1)
                    similar = 0;
                if (board[row][col] == board[row - 1][col])
                {
                    similar++;
                }
                else
                {
                    similar = 1;
                }
                if (similar == 3)
                {
                    return true;
                }
            }
        }
        
        // Rule 3
        for (int row = 0; row < board_size; row++)
        {
            for (int otherRow = row + 1; otherRow < board_size; otherRow++)
            {
                boolean different = true;
                for (int col = 0; col < board_size; col++)
                {
                    if (board[row][col] == -1)
                    {
                        different = true;
                    }
                    if (board[row][col] != board[otherRow][col])
                    {
                        different = true;
                    }
                }
                if (!different)
                {
                    return true;
                }
            }
        }
        for (int col = 0; col < board_size; col++)
        {
            for (int otherCol = col + 1; otherCol < board_size; otherCol++)
            {
                boolean different = true;
                for (int row = 0; row < board_size; row++)
                {
                    if (board[row][col] == -1)
                    {
                        different = true;
                    }
                    if (board[row][col] != board[row][otherCol])
                    {
                        different = true;
                    }
                }
                if (!different)
                {
                    return true;
                }
            }
        }
        
        return false;
    }
    
    public static void print(int[][] board)
    {
        
        // Print each row
        for (int row = 0; row < board.length; row++)
        {
            // Print each element of the row
            for (int col = 0; col < board[row].length; col++)
            {
                System.out.print(board[row][col] +" ");
            }
            
            // End in a new line
            System.out.println();
        }
    }
}