#include <bits/stdc++.h>
using namespace std;
ifstream in("input.txt");
ofstream out("output.txt");
const int MAXN = 1e5 + 7;
const long long MAXL = 1e18;
const int N = 1e7;
const double eps = 1e-11;
int main() {
  vector<vector<int> > all(9, vector<int>(9));
  for (int i = 0; i < 9; ++i) {
    for (int j = 0; j < 9; ++j) {
      char c;
      cin >> c;
      if (c == '.') {
        all[i][j] = 0;
      }
      if (c == 'x') {
        all[i][j] = 1;
      }
      if (c == 'o') {
        all[i][j] = 2;
      }
    }
  }
  int x, y;
  cin >> x >> y;
  x %= 3;
  y %= 3;
  x--;
  y--;
  if (x < 0) {
    x = 2;
  }
  if (y < 0) {
    y = 2;
  }
  bool can = false;
  for (int i = 3 * x; i < 3 * x + 3; ++i) {
    for (int j = 3 * y; j < 3 * y + 3; ++j) {
      if (!all[i][j]) {
        can = true;
        all[i][j] = -1;
      }
    }
  }
  if (!can) {
    for (int i = 0; i < 9; ++i) {
      for (int j = 0; j < 9; ++j) {
        if (!all[i][j]) {
          cout << '!';
        }
        if (all[i][j] == 1) {
          cout << 'x';
        }
        if (all[i][j] == 2) {
          cout << 'o';
        }
        if (j % 3 == 2) {
          cout << " ";
        }
      }
      cout << "\n";
      if (i % 3 == 2) {
        cout << "\n";
      }
    }
  } else {
    for (int i = 0; i < 9; ++i) {
      for (int j = 0; j < 9; ++j) {
        if (!all[i][j]) {
          cout << '.';
        }
        if (all[i][j] == 1) {
          cout << 'x';
        }
        if (all[i][j] == 2) {
          cout << 'o';
        }
        if (all[i][j] == -1) {
          cout << '!';
        }
        if (j % 3 == 2) {
          cout << " ";
        }
      }
      cout << "\n";
      if (i % 3 == 2) {
        cout << "\n";
      }
    }
  }
  return 0;
}
