const gr=1000;
      int=128;
type matrp=record
            br:longint;
            d:array[1..gr] of byte;
           end;
     matrs=record
            br:longint;
            d:array[1..gr] of longint;
           end;
     tzau=record
           br:longint;
           d:array[1..gr*gr] of longint;
          end;
var a,b,n,i,j,k:longint;
    zaup,zaus:tzau;
    sum:array[0..2*int] of matrs;
    pr:array[0..gr*gr-(gr-int)*(gr-int)] of matrp;
    f:text;
procedure izbacis(u:longint;var niz:matrs);
begin
 j:=1;
 while ((niz.d[j]<>u)and(j<=niz.br)) do
    inc(j);
 if j<=niz.br then begin
                    niz.d[j]:=niz.d[niz.br];
                    dec(niz.br);
                   end;
end;
procedure izbacip(u:longint;var niz:matrp);
begin
 j:=1;
 while ((niz.d[j]<>u)and(j<=niz.br)) do
    inc(j);
 if j<=niz.br then begin
                    niz.d[j]:=niz.d[niz.br];
                    dec(niz.br);
                   end;
end;
procedure izbaci(u:longint;var niz:tzau);
begin
 j:=1;
 while ((niz.d[j]<>u)and(j<=niz.br)) do
    inc(j);
 if j<=niz.br then begin
                    niz.d[j]:=niz.d[niz.br];
                    dec(niz.br);
                   end;
end;
procedure skini_pr;
begin
 zaus.br:=0;
 for i:=1 to zaup.br do
   begin
    izbacis(zaup.d[i],sum[pr[zaup.d[i]-a*a].d[1]]);
    if sum[pr[zaup.d[i]-a*a].d[1]].br=1 then begin
                                              inc(zaus.br);
                                              zaus.d[zaus.br]:=pr[zaup.d[i]-a*a].d[1];
                                             end
                                        else if sum[pr[zaup.d[i]-a*a].d[1]].br=0 then izbaci(pr[zaup.d[i]-a*a].d[1],zaus);
   end;
end;
procedure skini_sumu;
begin
 zaup.br:=0;
 for i:=1 to zaus.br do
   begin
    izbacip(zaus.d[i],pr[sum[zaus.d[i]].d[1]-a*a]);
    if pr[sum[zaus.d[i]].d[1]-a*a].br=1 then begin
                                              inc(zaup.br);
                                              zaup.d[zaup.br]:=sum[zaus.d[i]].d[1];
                                             end
                                        else if pr[sum[zaus.d[i]].d[1]-a*a].br=0 then izbaci(sum[zaus.d[i]].d[1],zaup);

   end;
end;
begin
 assign(f,'prosim.in');
 reset(f);
 readln(f,a,b,n);
 close(f);
 for i:=a*a to b*b do
   pr[i-a*a].br:=0;
 for i:=2*a to 2*b do
   sum[i-2*a].br:=0;
 for i:=a to b do
   for j:=i to b do
     begin
      inc(pr[i*j-a*a].br);
      pr[i*j-a*a].d[pr[i*j-a*a].br]:=i+j-2*a;
      inc(sum[i+j-2*a].br);
      sum[i+j-2*a].d[sum[i+j-2*a].br]:=i*j;
     end;
 zaup.br:=0;
 for i:=a*a to b*b do
   if pr[i-a*a].br=1 then begin
                           inc(zaup.br);
                           zaup.d[zaup.br]:=i;
                          end;
 for k:=1 to n do
   begin
    skini_pr;
    skini_sumu;
   end;
 assign(f,'prosim.out');
 rewrite(f);
 for i:=1 to zaup.br do
   writeln(f,trunc(((pr[zaup.d[i]-a*a].d[1]+2*a)-sqrt((pr[zaup.d[i]-a*a].d[1]+2*a)*(pr[zaup.d[i]-a*a].d[1]+2*a)-4*zaup.d[i]))/2),
            ' ',(pr[zaup.d[i]-a*a].d[1]+2*a)-
           trunc(((pr[zaup.d[i]-a*a].d[1]+2*a)-sqrt((pr[zaup.d[i]-a*a].d[1]+2*a)*(pr[zaup.d[i]-a*a].d[1]+2*a)-4*zaup.d[i]))/2));
 close(f);
end.



