#include<stdio.h>
int main(void){
  system("python -c \"h,w=map(int,input().split());r=[list('#'+'#.'[i%2]*(w-2)+'.')for i in range(h)];b=[list('.'+'.#'[i%2]*(w-2)+'#')for i in range(h)]\nfor i in range(h):\n  t=input()\n  for j in range(w):\n    if t[j]=='#':r[i][j]=b[i][j]='#'\nfor t in r:print(''.join(t))\nprint()\nfor t in b:print(''.join(t))\"");
  return 0;
}