program piramide;

   const PRF = 'PIRAM.IN';
         RZF = 'PIRAM.OUT';

   var f: text;
	   n, a: integer;
begin
	assign(f, PRF);
	reset(f);
	readln(f, n);
	close(f);
	
	a := 1; { pradedame nuo virðutinio aukðto }
	while a*a <= n do begin { kol pakanka tauriø, pridedame aukðtà }
		n := n - a*a;
		a := a + 1;
	end;
	a := a - 1;
	
	assign(f, RZF);
	rewrite(f);
	writeln(f, a, ' ', n);
	close(f);
end.

