#include <iostream>
#include <vector>
using namespace std;
string a[10];
string op[20][10];
int num[3];
const string d[15][10] = {{"xxxxx",
"x...x",
"x...x",
"x...x",
"x...x",
"x...x",
"xxxxx"
},
{
"....x",
"....x",
"....x",
"....x",
"....x",
"....x",
"....x"
},
{
"xxxxx",
"....x",
"....x",
"xxxxx",
"x....",
"x....",
"xxxxx"
},
{
"xxxxx",
"....x",
"....x",
"xxxxx",
"....x",
"....x",
"xxxxx"
},
{
"x...x",
"x...x",
"x...x",
"xxxxx",
"....x",
"....x",
"....x"
},
{
"xxxxx",
"x....",
"x....",
"xxxxx",
"....x",
"....x",
"xxxxx"
},
{
"xxxxx",
"x....",
"x....",
"xxxxx",
"x...x",
"x...x",
"xxxxx"
},
{
"xxxxx",
"....x",
"....x",
"....x",
"....x",
"....x",
"....x"
},
{
"xxxxx",
"x...x",
"x...x",
"xxxxx",
"x...x",
"x...x",
"xxxxx"
},
{
"xxxxx",
"x...x",
"x...x",
"xxxxx",
"....x",
"....x",
"xxxxx"
},
{
".....",
"..x..",
"..x..",
"xxxxx",
"..x..",
"..x..",
"....."
}
};
int main()
{
for (int i = 1; i <= 7; i++)
{
cin >> a[i];
a[i] += '.';
}
int s = a[1].size() / 6;
for (int i = 1; i <= 7; i++)
{
for (int j = 0; j < (int)a[i].size(); j += 6)
{
op[j / 6 + 1][i] += a[i][j];
op[j / 6 + 1][i] += a[i][j + 1];
op[j / 6 + 1][i] += a[i][j + 2];
op[j / 6 + 1][i] += a[i][j + 3];
op[j / 6 + 1][i] += a[i][j + 4];
}
}
int k = 1;
for (int i = 1; i <= s; i++)
{
for (int j = 0; j <= 10; j++)
{
bool f = false;
for (int l = 0; l < 7; l++)
{
if (d[j][l] != op[i][l + 1])
{
f = true;
break;
}
}
if (!f)
{
if (j == 10) k++;
else
{
num[k] += j;
num[k] *= 10;
}
}
}
}
num[1] /= 10;
num[2] /= 10;
int ans = num[1] + num[2];
vector<int> st;
do
{
st.push_back(ans % 10);
}
while (ans /= 10, ans);
for (int k = 0; k < 7; k++)
{
for (int i = st.size()-1; i >= 0; i--)
{
cout << d[st[i]][k];
if(i!=0) cout << '.';
}
puts("");
}
return 0;
}