import java.io.*;
import java.util.*;

public class BinaryTestString {
        
    public static void main(String[] args) throws Exception{
        File DATA3 = new File("DATA3.txt");
		File OUT3 = new File("OUT3.txt");
   		
   		BufferedReader reader = new BufferedReader(new FileReader(DATA3) );
   		Writer writer = new BufferedWriter(new FileWriter(OUT3) );
        String[] input = new String[6];
        String combo;
        int x = 0;
        for (x = 0; x < 5; x++){
        	input[x] = reader.readLine();
        }
        boolean a = false;	
        int i,j,k,n,y,length = 0;
        for (y = 0; y < 5; y++)//line
	        for(i = 0; i < 2; i++)
	        	for(j = 0; j < 2; j++)
	        		for(k = 0; k < 2; k++)
	        			for(n = 0; n < 2; n++){
	        				a = false;
	        				combo = "" + i + j + k + n;
	        				for (x = 0; x < 5 - input[y].length(); x++){
	        					if ( (combo.substring(x, x + input[y].length() ).equals(input[y]) ) == false){
	          						a = true;
	        					}
	        				}
	        			if(a)
	        				writer.write(combo + "\r\n");
	        			}
	writer.close();
	reader.close();
    }
}

