{$O-,Q+,R+}
uses SysUtils;

const MaxN = 100000;

var f : array [1..MaxN, 'a'..'z'] of boolean;
    c : array [1..MaxN] of integer;
    x : char;
    n, l, k, i, j : integer;

begin
  n := strtoint (paramstr (1));
  l := strtoint (paramstr (2));
  k := strtoint (paramstr (3));
  randseed := strtoint (paramstr (4));
  assert (int64 (n) * l <= MaxN);
  writeln (l, ' ', n);
  for i := 1 to l do c[i] := k;
  for i := 1 to n do begin
    for j := 1 to l do begin
      repeat
        x := chr (random (k) + ord ('a'));
      until f[j, x] or (c[j] > 1);
      if not f[j, x] then dec (c[j]);
      f[j, x] := true;
      write (x);
    end;
    writeln;
  end;
  for i := 1 to 2 do begin
    for j := 1 to l do begin
      repeat
        x := chr (random (k) + ord ('a'));
      until not f[j, x];
      write (x);
    end;
    writeln;
  end;
end.