const 
  maxn = 50;
var
  i, j, cnt, all, n: longint;
  s : array[1..maxn] of string[maxn];
begin
  reset(input, 'cities.in');
  rewrite(output, 'cities.out');
  readln(n);
  all := 0;
  for i := 1 to n do begin
    readln(s[i]);
    for j := 1 to n do begin
      if (s[i][j] = 'C') then begin
        all := all + 1;
      end;
    end;
  end;
  cnt := 0;
  for i := 1 to n do begin
    for j := 1 to n do begin
      if (cnt < all div 2) then begin
        write(1);
      end else begin
        write(2);
      end;
      if (s[i][j] = 'C') then
        cnt := cnt + 1;
    end;
    writeln;
  end;
end.