import java.io.*;
import java.util.*;

public class PassHash{
	
	public static void main(String[] args){
		try{
			File infile = new File("data5.txt");
			File outfile = new File("out5.txt");
			Scanner input = new Scanner(infile);
			PrintStream ps = new PrintStream(new FileOutputStream(outfile));
			String[] hashList = new String[5], passList = new String[5];
			int temp;
			for (int h=0;h<5;h++){
				hashList[h]=Integer.toString(input.nextInt());
			}
			input.close();
			for (int i=65;i<91;i++){
				for (int j=65;j<91;j++){
					for (int k=65;k<91;k++){
						for (int l=65;l<91;l++){
							temp = (i*1000000+j*10000+k*100+l)%(i*11+j*101+k*1009+l*10007);
							for (int hash=0;hash<5;hash++){
								if (Integer.toString(temp).equals(hashList[hash])){
									System.out.println("lawjelfje");
									passList[hash]=Character.toString((char)i)+Character.toString((char)j)+Character.toString((char)k)+Character.toString((char)l);
								}
							}
						}
					}
				}	
			}
			for (int pass=0;pass<5;pass++){
				ps.println(passList[pass]);
			}
			ps.close();
		} catch (IOException e){
			e.printStackTrace();
		}
	}
}
