h, w = io.read("*n", "*n", "*l") x1, y1, x2, y2, x3, y3 = 0, 0, 0, 0, 0, 0 for y = 1, h, 1 do s = io.read() for x = 1, w, 1 do a = string.sub(s, x, x) if(a == "*") then if(x1 == 0) then x1, y1 = x, y; elseif(x2 == 0) then x2, y2 = x, y; end end end end if(x1 == x2) then x3, y3 = 1 + x1 % w, y1 elseif(y1 == y2) then x3, y3 = x1, 1 + y1 % h else x3, y3 = x1, y2 end for y = 1, h, 1 do for x = 1, w, 1 do if((x1 == x and y1 == y) or (x2 == x and y2 == y) or (x3 == x and y3 == y)) then io.write("*") else io.write("-") end end io.write("\n") end