#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
    int a,b;
    cin >> a >> b;
    string ulaz;
    vector<string> vec;
    for(int i = 0; i < b; ++i){
        cin >>ulaz;
        vec.push_back(ulaz);
    }
    if(a != b){
        cout << -1;
    }
    else{
        for(int i = 0; i < a; ++i){
            for(int j = 0; j < a; ++j){
                if(i==j){
                    cout << "C";
                }
                else{
                    cout << ".";
                }
            }
            cout << endl;
        }
    }
    return 0;
}