{$R+}
uses
  Math;
var
  a: array of String;
  N, x, y, steps, step, i, dx, dy, t: Integer;
  f: TextFile;
begin
  AssignFile(f, 'input.txt'); Reset(f);
  Readln(f, N, x, y, steps);
  SetLength(a, N + 1);
  for i := 1 to N do Readln(f, a[i]);
  CloseFile(f);

  dx := 0; dy := -1;
  
  for step := 1 to steps do begin
    while
      InRange(x + dx, 1, N) and
      InRange(y + dy, 1, N) and
      (a[y + dy, x + dx] = '#')
    do begin
      t := dy; dy := -dx; dx := t;
    end;
    Inc(x, dx);
    Inc(y, dy);
  end;

  AssignFile(f, 'output.txt'); Rewrite(f);
  Writeln(f, x, ' ', y);
  CloseFile(f);
end.
