import java.io.*;
import java.util.*;

public class BinaryTest{
	public static void main (String[] args){
		File infile = new File("data3.txt");
		File outfile = new File("out3.txt");
		Scanner reader;
		PrintStream ps;
		try{
			reader = new Scanner(infile);
			ps = new PrintStream(new FileOutputStream(outfile));
			String pattern, testString;
			for (int i=0; i<5; i++){
				pattern=reader.next();
				for (int j=0;j<16;j++){
					testString = Integer.toBinaryString(j);
					while (testString.length()<4){
						testString = "0" + testString;
					}
					if ((testString+testString).indexOf(pattern)==-1){
						ps.print(testString);
						ps.println();
					}
				}
			}
			ps.close();
			reader.close();
		} catch (Exception e){
			System.err.println("This operation could not be completed.");
			System.err.println(e.getMessage());
		}
	}
}
