#include <bits/stdc++.h>
using namespace std;
char s[100];
int st[10][10], x, y;
int main() {
  for (int i = 1; i <= 9; i++)
    for (int j = 1; j <= 3; j++) {
      scanf("%s", s + 1);
      for (int k = 1; k <= 3; k++) {
        if (s[k] == '.') st[i][(j - 1) * 3 + k] = 0;
        if (s[k] == 'x') st[i][(j - 1) * 3 + k] = 1;
        if (s[k] == 'o') st[i][(j - 1) * 3 + k] = 2;
      }
    }
  scanf("%d%d", &x, &y);
  x = x % 3, y = y % 3;
  if (x == 0) x = 3;
  if (y == 0) y = 3;
  int flag = 1;
  for (int i = x * 3 - 2; i <= x * 3; i++)
    for (int j = y * 3 - 2; j <= y * 3; j++) {
      if (st[i][j] == 0) {
        flag = 0;
        st[i][j] = 4;
      }
    }
  if (flag) {
    for (int i = 1; i <= 9; i++) {
      for (int j = 1; j <= 3; j++) {
        for (int k = 1; k <= 3; k++) {
          if (st[i][j * 3 - 3 + k] == 0) cout << "!";
          if (st[i][j * 3 - 3 + k] == 1) cout << "x";
          if (st[i][j * 3 - 3 + k] == 2) cout << "o";
          if (st[i][j * 3 - 3 + k] == 4) cout << "!";
        }
        cout << " ";
      }
      cout << endl;
      if (i % 3 == 0) cout << endl;
    }
  } else {
    for (int i = 1; i <= 8; i++) {
      for (int j = 1; j <= 3; j++) {
        for (int k = 1; k <= 3; k++) {
          if (st[i][j * 3 - 3 + k] == 0) cout << ".";
          if (st[i][j * 3 - 3 + k] == 1) cout << "x";
          if (st[i][j * 3 - 3 + k] == 2) cout << "o";
          if (st[i][j * 3 - 3 + k] == 4) cout << "!";
        }
        cout << " ";
      }
      cout << endl;
      if (i % 3 == 0) cout << endl;
    }
    for (int j = 1; j <= 3; j++) {
      for (int k = 1; k <= 3; k++) {
        if (st[9][j * 3 - 3 + k] == 0) cout << ".";
        if (st[9][j * 3 - 3 + k] == 1) cout << "x";
        if (st[9][j * 3 - 3 + k] == 2) cout << "o";
        if (st[9][j * 3 - 3 + k] == 4) cout << "!";
      }
      cout << " ";
    }
  }
}
