#include<stdio.h>
#include<math.h>
long long int s,a,c,d,b,f;
int main()
{

    scanf("%lld",&s);
    while(s!=0)
    {
       for(a=1;a<=s;a=a+1)
       {
            f=0;
            c=a-a*a-2*s;
            d=1-4*c;
           // printf("%lld ",a);
             //printf("%lld %lld ",c,d);
            if(d>=0)
            {
                d=sqrt(d);
                b=(d-1)/2;
                //printf("%lld %lld\n",d,b);
                if((a+b)*(b-a+1)==2*s)
                {
                   // printf("%lld %lld\n",(a+b)*(b-a+1),s);
                    printf("%lld %lld\n",a,b-a+1);
                    f=1;
                }
            }
            if(f==1)
                break;
       }
       scanf("%lld",&s);
    }
    return 0;
}

