<Problem>
http://ntucoder.net/Problem/Details/1143
Uses Crt;
Var i,n,m,j:longint;
a,b:array[0..10000] of longint;
Procedure Sort(l,r:longint);
var i,j,x,tg:longint;
begin
i:=l; j:=r; x:=a[(l+r) div 2];
repeat
while (a[i]<x) do inc(i); while (a[j]>x) do dec(j);
if i<=j then begin tg:=a[i]; a[i]:=a[j]; a[j]:=tg; inc(i); dec(j); end; //write('1');
until i>j;
if (l<j) then sort(l,j); if (i<r) then sort(i,r); //write('1');
end;
Begin
readln(n,m);
for i:=1 to n+m do
begin
read(a[i]);
b[i]:=a[i];
end;
sort(1,n+m); //write('a');
for i:=1 to n+m do
for j:=1 to n+m do
if (a[i]=b[j]) then
begin
if (j<=n) then write('b',j,' ')
else write('c',j-n,' ');
break;
end;
readln;
End.