#include <iostream>

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    char c[N][M];
    for(int i = 1; i <= N; i++){
        for(int j = 1; j<= M; j++){
            cin >> c[i][j];
        }
    }

    for(int i = 1; i <= N; i++){
        for(int j = 1; j<= M; j++){
            if(i == j){
                c[i][j] = 'C';
            }
        }

    }
    cout << endl;
    for(int i = 1; i <= N; i++){
        for(int j = 1; j<= M; j++){
            cout << c[i][j] << " ";

        }
        cout << endl;
    }
    return 0;
}