h,w = map(int,input().split()) for i in range(h): che = input() if 'y9' in che: print(che.replace('y9','Y9')) elif '9y' in che: print(che.replace('9y','9Y')) else: print(che)