import java.util.Scanner;

public class mind1 {

	
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
         int c1=1,c2=1,n=1;
         c1=1;
        	while ((c1!=0) || (c2!=0) || (n!=0) )
        	{
        		n = sc.nextInt();
        		c1 = sc.nextInt();
        		c2 = sc.nextInt();
        		if (c1!=0 || c2!=0 || n!=0 )
        		{
        			String m=""+n;
        			String c3=""+c1;
        			String c4=""+c2;
        			String result=m.replace(c3,c4);
        			System.out.println(result);
        		}
        	}
    		System.out.println("afsdgsdgh");
	}

}