#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void read(T &...args) {
  ((cin >> args), ...);
};
template <typename... T>
void write(T &&...args) {
  ((cout << args << " "), ...);
};
char b[9][9];
int main() {
  for (__typeof(9) i = (0) - ((0) > (9)); i != (9) - ((0) > (9));
       i += 1 - 2 * ((0) > (9))) {
    for (__typeof(9) j = (0) - ((0) > (9)); j != (9) - ((0) > (9));
         j += 1 - 2 * ((0) > (9))) {
      char c;
      read(c);
      b[i][j] = c;
    };
  };
  int x, y;
  read(x, y);
  int xb = floor((x - 1) / 3);
  int yb = floor((y - 1) / 3);
  int xs = (x - 1) % 3;
  int ys = (y - 1) % 3;
  int isPossibleFill = 0;
  for (__typeof(3) i = (0) - ((0) > (3)); i != (3) - ((0) > (3));
       i += 1 - 2 * ((0) > (3))) {
    for (__typeof(3) j = (0) - ((0) > (3)); j != (3) - ((0) > (3));
         j += 1 - 2 * ((0) > (3))) {
      int xn = 3 * xs + i + 1;
      int yn = 3 * ys + j + 1;
      if (b[xn - 1][yn - 1] == '.') {
        isPossibleFill = 1;
        b[xn - 1][yn - 1] = '!';
      };
    };
  };
  if (!isPossibleFill) {
    for (__typeof(9) i = (0) - ((0) > (9)); i != (9) - ((0) > (9));
         i += 1 - 2 * ((0) > (9))) {
      for (__typeof(9) j = (0) - ((0) > (9)); j != (9) - ((0) > (9));
           j += 1 - 2 * ((0) > (9))) {
        if (b[i][j] == '.') {
          b[i][j] = '!';
        };
      };
    };
  };
  for (__typeof(9) i = (0) - ((0) > (9)); i != (9) - ((0) > (9));
       i += 1 - 2 * ((0) > (9))) {
    if ((i % 3) == 0 && i != 0) cout << "\n";
    for (__typeof(9) j = (0) - ((0) > (9)); j != (9) - ((0) > (9));
         j += 1 - 2 * ((0) > (9))) {
      if ((j % 3) == 0 && j != 0) cout << " ";
      cout << b[i][j];
    };
    cout << "\n";
  };
  return 0;
};
