#include <bits/stdc++.h>
using namespace std;
int A[3][3];
char c[9][9];
bool uz;
void F(int x, int y) {
  int s1, s2;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) {
      s1 = i / 3, s2 = j / 3;
      if (s1 == x && s2 == y && c[i][j] == '.') {
        c[i][j] = '!';
        uz = 1;
      }
    }
}
int main() {
  int s1, s2;
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < 9; j++) {
      cin >> c[i][j];
    }
  int n, m;
  cin >> n >> m;
  char f;
  if (c[n - 1][m - 1] == 'o')
    f = 'x';
  else
    f = 'o';
  F((n - 1) % 3, (m - 1) % 3);
  if (uz == 0)
    for (int i = 0; i < 9; i++)
      for (int j = 0; j < 9; j++)
        if (c[i][j] == '.') c[i][j] = '!';
  for (int i = 0; i < 9; i++) {
    for (int j = 0; j < 9; j++) {
      cout << c[i][j];
      if (j % 3 == 2 && j != 8) cout << " ";
    }
    cout << endl;
    if (i % 3 == 2 && i != 8) cout << endl;
  }
  return 0;
}
