https://ac.nowcoder.com/acm/contest/76795/C
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PII;
typedef vector<long long> VI;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define pb(i) push_back(i)
#define int long long
#define INF 0x3f3f3f3f
#define oz 998244353
#define endl '\n'
#define N 3010
const int mod = 1e9 + 7;
int dx[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
int p[N], si[N];
int find(int x) {
if (x != p[x]) p[x] = find(p[x]);
return p[x];
}
//size[find(b)] += size[find(a)];
//p[find(a)] = find(b);
int n, m;
int st[N][N]; //存Red的是否访问
set<PII> se; //判断能否一轮消灭Blue
char g[N][N];
void dfs(int a, int b) { //遍历Red连通块
st[a][b] = 1;
rep(i, 0, 3) {
int x = dx[i][0] + a, y = dx[i][1] + b;
if (x >= 1 && x <= n && y >= 1 && y <= m) {
if (g[x][y] == '.') {
se.insert({x, y});
} else if (!st[x][y])
dfs(x, y);
}
}
}
void solve() {
cin >> n >> m;
int blue = 0;
rep(i, 1, n) {
rep(j, 1, m) {
cin >> g[i][j];
if (g[i][j] == '.')blue ++;
st[i][j] = 0; //多组样例 刷新状态数组
}
}
int win = 0;
rep(i, 1, n) {
rep(j, 1, m) {
if (g[i][j] == '#' && !st[i][j]) {
se.clear();
dfs(i, j);
if ((int)se.size() == blue) {
win = 1;
}
}
}
}
if(blue == n * m)cout << "Blue" << endl;
else if(!win)cout << "Draw" << endl;
else cout << "Red" << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
cin >> T;
while (T --)
solve();
return 0;
}