#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
const int maxn = 10 + 7;
char input[maxn][maxn] = {0};
int n;
int main()
{
int t;
cin >> t;
for (int kCase = 1; kCase <= t; kCase++) {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> (input[i] + 1);
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (input[i][j] == '.') {
for (char ch = 'A'; ch <= 'Z'; ch++) {
bool ok = true;
if (input[i - 1][j] == ch)ok = false;
if (input[i + 1][j] == ch)ok = false;
if (input[i ][j - 1] == ch)ok = false;
if (input[i ][j + 1] == ch)ok = false;
if (ok) { input[i][j] = ch; break; }
}
}
}
}
cout << "Case " << kCase << ":" << endl;
for (int i = 1; i <= n; i++) {
cout << (input[i] + 1) << endl;
}
}
return 0;
}
uva11520
最新推荐文章于 2024-08-19 16:28:10 发布