H=0...gets.to_i
W=0...gets.to_i
G=readlines
def z(x,y)(H===y&&W===x&&' '!=G[y][x])?1:0 end
H.each{|j|W.each{|i|l=G[j][i]
G[j][i]="@V;#{l}>Fb#{l}<Yd#{l*5}"[z(i+1,j)*8+z(i-1,j)*4+z(i,j+1)*2+z(i,j-1)]if' '!=l}}
puts G
SD0wLi4uZ2V0cy50b19pClc9MC4uLmdldHMudG9faQpHPXJlYWRsaW5lcwpkZWYgeih4LHkpKEg9PT15JiZXPT09eCYmJyAnIT1HW3ldW3hdKT8xOjAgZW5kCkguZWFjaHt8anxXLmVhY2h7fGl8bD1HW2pdW2ldCkdbal1baV09IkBWOyN7bH0+RmIje2x9PFlkI3tsKjV9Ilt6KGkrMSxqKSo4K3ooaS0xLGopKjQreihpLGorMSkqMit6KGksai0xKV1pZicgJyE9bH19CnB1dHMgRw==
MTIKMTgKICAgeHggIHh4eCAgeHh4ICAgCiAgeHh4eCAgeHh4ICB4eHggIAogeHh4eHh4ICB4eHggIHh4eCAKeHh4ICB4eHggIHh4eCAgeHh4Cnh4eHggeHh4ICB4eHggIHh4eAogeHh4eHh4ICB4eHggIHh4eCAKICB4eHh4ICB4eHggIHh4eCAgCnggIHh4ICB4eHggIHh4eCAgeAp4eCAgICB4eHggIHh4eCAgeHgKeHh4ICB4eHggIHh4eCAgeHh4Cnh4eHggIHh4eCAgeHh4ICB4eAp4eHh4eCAgeHh4ICB4eHggIHg=
12
18
xx xxx xxx
xxxx xxx xxx
xxxxxx xxx xxx
xxx xxx xxx xxx
xxxx xxx xxx xxx
xxxxxx xxx xxx
xxxx xxx xxx
x xx xxx xxx x
xx xxx xxx xx
xxx xxx xxx xxx
xxxx xxx xxx xx
xxxxx xxx xxx x