{$R+,Q+}

{$ifdef VER70}
{$else}
{$inline on}
{$endif}

program Cells;

type IsInside = (IsBefore, JustInside, IsAfter);

var GLOBAL_IDX, GLOBAL_FROM, GLOBAL_NUM: longint;
    fill_size,fill_only_size:array['A'..'Z'] of longint;


function write_(ch:char):IsInside; {$ifdef VER70}{$else}inline;{$endif}
Begin
  inc(GLOBAL_IDX);
  if GLOBAL_IDX < GLOBAL_FROM then begin
    write_:=IsBefore; exit
  end;
  if GLOBAL_IDX-GLOBAL_FROM+1 <= GLOBAL_NUM then begin
    write(ch);
    write_:=JustInside;
    exit
  end;
  write_:=IsAfter
End;

procedure free(ch : char); forward; { заголовок без блока }

procedure fillOnly(ch : char);
begin
  if ch = 'a' then write_('A')
  else begin
    if GLOBAL_FROM-GLOBAL_IDX > fill_only_size[upcase(ch)] then
      inc(GLOBAL_IDX,fill_only_size[upcase(ch)])
    else begin
      fillOnly(pred(ch));
      if write_(upcase(ch)) <> IsAfter then
        free(pred(ch))
    end
  end
end;
procedure free(ch : char);
begin
  if ch = 'a' then write_('a')
  else begin
    fillOnly(pred(ch));
    if write_(ch) <> IsAfter then
      free(pred(ch))
  end
end;
procedure fill(ch : char);
begin
  if ch = 'a' then write_('A') else
  if ch = 'b' then begin write_('A'); write_('B') end
  else begin
    fillOnly(pred(ch));
    if write_(upcase(ch))<> IsAfter then
      if GLOBAL_IDX+fill_size[upcase(ch)]<GLOBAL_FROM then
        inc(GLOBAL_IDX,fill_size[upcase(ch)])
      else
        fill(pred(pred(ch)));
  end
end;

var last_char,ch:char;

begin
  readln(last_char, GLOBAL_FROM, GLOBAL_NUM);

  fill_size['A']:=1;
  fill_only_size['A']:=1;
  for ch:='B' to upcase(last_char) do begin
    fill_size[ch]:=2*fill_size[pred(ch)];
    fill_only_size[ch]:=2*fill_only_size[pred(ch)];
    if (ord(ch)-ord('A')) mod 2 = 0 then
      inc(fill_size[ch]);
    inc(fill_only_size[ch]);
  end;

  GLOBAL_IDX:=0;
  fill(last_char); writeln;

  {
  read(last_char);

  GLOBAL_FROM:=1;
  GLOBAL_NUM:=MaxLongInt;
  FillOnly(last_char);
  }
end.
