#include <bits/stdc++.h>
#include "mars.h"
using namespace std;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};
string process(vector<vector<string>> a, int i, int j, int k, int n) {
n = 2 * n + 1;
vector<vector<int>> s(n, vector<int>(n));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
s[i][j] = a[i][j][0] - '0';
}
}
auto inside = [&](int x, int y) {
return (0 <= x && x < n && 0 <= y && y < n);
};
vector<vector<bool>> vis(n, vector<bool>(n));
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (s[i][j] == 0 || vis[i][j]) continue;
ans++;
queue<pair<int, int>> q;
q.push({i, j});
vis[i][j] = true;
while (!q.empty()) {
auto [x, y] = q.front();
q.pop();
for (int d = 0; d < 4; d++) {
int nx = x + dx[d];
int ny = y + dy[d];
if (inside(nx, ny) && !vis[nx][ny] && s[nx][ny] == 1) {
vis[nx][ny] = true;
q.push({nx, ny});
}
}
}
}
}
string ret(100, '0');
for (int i = 0; i < 10; i++) {
if (ans & (1 << i)) {
ret[i] = '1';
}
}
return ret;
}