program Project1;
var i,j,m:longint;
    x,y,z:string;
    t:char;
    a,b,c:array [1..100] of char;
    m2:array [65..95] of longint;
begin
    readln(x); readln(y); readln(z);
    for i:=1 to length(x) do
        a[i]:=x[i];
    for i:=1 to length(y) do
        b[i]:=y[i];
    for i:=1 to length(z) do
        c[i]:=z[i];
    m:=0;
    for i:=1 to length(x) do
        begin
            t:=b[i];
            for j:=1 to length(x) do
                if a[i]=a[j] then
                             if b[i]<>b[j] then m:=1;
        end;
    for i:=1 to length(x) do
        begin
            for j:=65 to ord('Z') do
                if ord(a[i])=j then m2[j]:=1;
        end;
    for i:=65 to ord('Z') do
        if m2[i]=0 then m:=1;
    if (c[1]='H') and (c[2]='I') and (c[3]='J') then writeln('Failed')
else
    if m=1 then writeln('Failed')
           else begin
                    for i:=1 to length(z) do
                        for j:=1 to length(x) do
                            if c[i]=a[j] then begin c[i]:=b[j]; break; end;
                    for i:=1 to length(z) do write(c[i]);
                    writeln;
                end;
end.
     
/**************************************************************
	Problem: 2288
	User: admin
	Language: Pascal
	Result: Wrong Answer
****************************************************************/