#include <bits/stdc++.h>
using namespace std;
int a[9][9];
int main() {
  ios::sync_with_stdio(false);
  int i, j, k;
  int chn = 0;
  int r, c;
  char ch;
  for (i = 0; i < 9; i++) {
    for (j = 0; j < 9; j++) {
      cin >> ch;
      if (ch == '.') {
        a[i][j] = 0;
      } else if (ch == 'x') {
        a[i][j] = 1;
      } else if (ch == 'o') {
        a[i][j] = 2;
      }
    }
  }
  cin >> r >> c;
  if (r == 1 || r == 4 || r == 7) {
    r = 0;
  } else if (r == 2 || r == 5 || r == 8) {
    r = 1;
  } else if (r == 3 || r == 6 || r == 9) {
    r = 2;
  }
  if (c == 1 || c == 4 || c == 7) {
    c = 0;
  } else if (c == 2 || c == 5 || c == 8) {
    c = 1;
  } else if (c == 3 || c == 6 || c == 9) {
    c = 2;
  }
  for (i = 3 * r; i < 3 * r + 3; i++) {
    for (j = 3 * c; j < 3 * c + 3; j++) {
      if (a[i][j] == 0) {
        chn++;
        a[i][j] = -1;
      }
    }
  }
  if (chn == 0) {
    for (i = 0; i < 9; i++) {
      for (j = 0; j < 9; j++) {
        if (a[i][j] == 1) {
          cout << 'x';
        }
        if (a[i][j] == 2) {
          cout << 'o';
        }
        if (a[i][j] == 0) {
          cout << '!';
        }
        if (j == 2 || j == 5) {
          cout << " ";
        }
        if (j == 8) {
          cout << "\n";
        }
      }
      if (i == 2 || i == 5) {
        cout << "\n";
      }
    }
  } else {
    for (i = 0; i < 9; i++) {
      for (j = 0; j < 9; j++) {
        if (a[i][j] == 1) {
          cout << 'x';
        }
        if (a[i][j] == 2) {
          cout << 'o';
        }
        if (a[i][j] == 0) {
          cout << '.';
        }
        if (a[i][j] == -1) {
          cout << '!';
        }
        if (j == 2 || j == 5) {
          cout << " ";
        }
        if (j == 8) {
          cout << "\n";
        }
      }
      if (i == 2 || i == 5) {
        cout << "\n";
      }
    }
  }
  return 0;
}
