In Omkar's last class of math, he learned about the least common multiple, or $$$LCM$$$. $$$LCM(a, b)$$$ is the smallest positive integer $$$x$$$ which is divisible by both $$$a$$$ and $$$b$$$.Omkar, having a laudably curious mind, immediately thought of a problem involving the $$$LCM$$$ operation: given an integer $$$n$$$, find positive integers $$$a$$$ and $$$b$$$ such that $$$a + b = n$$$ and $$$LCM(a, b)$$$ is the minimum value possible.Can you help Omkar solve his ludicrously challenging math problem?

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \leq t \leq 10$$$). Description of the test cases follows. Each test case consists of a single integer $$$n$$$ ($$$2 \leq n \leq 10^{9}$$$).

For each test case, output two positive integers $$$a$$$ and $$$b$$$, such that $$$a + b = n$$$ and $$$LCM(a, b)$$$ is the minimum possible.

NoteFor the first test case, the numbers we can choose are $$$1, 3$$$ or $$$2, 2$$$. $$$LCM(1, 3) = 3$$$ and $$$LCM(2, 2) = 2$$$, so we output $$$2 \ 2$$$.For the second test case, the numbers we can choose are $$$1, 5$$$, $$$2, 4$$$, or $$$3, 3$$$. $$$LCM(1, 5) = 5$$$, $$$LCM(2, 4) = 4$$$, and $$$LCM(3, 3) = 3$$$, so we output $$$3 \ 3$$$.For the third test case, $$$LCM(3, 6) = 6$$$. It can be shown that there are no other pairs of numbers which sum to $$$9$$$ that have a lower $$$LCM$$$.

#include<stdio.h>
int main()
{
  int t;
  scanf("%d",&t);
  while(t--)
   {
     int n,p=0;
     scanf("%d",&n);
     for(int i=2;i<=1000000;i++)
      {
         if(n%i==0)
           {
             p=i;
             break;
           }
      }
      if(p==0) p=n;
      printf("%d %d\n",n/p,n-(n/p));
   }
 return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,i,t;
    scanf("%d",&t);
    while(t--)
    {
    scanf("%d",&n);
    int x1,x2,c=0;
    int limit=sqrt(n)+1;
    for(i=2;i<=limit;i++)
    {
        if(n%i==0)
        {
          x1=n/i;
          x2=x1*(i-1);
          if(x1<=x2)
          {
              if(x2%x1==0)
              {
                  printf("%d %d\n",x1,x2);
                  c++;
                  break;
              }
          }
        }
    }
    if(c==0)
        printf("1 %d\n",n-1);
    }
    return 0;
}

#include <stdio.h>
#include<string.h>
#include<math.h>

void joss_joss()
{
    long long int n,i,x,y,m;
    scanf("%lld",&n);
   x=1;
   y=n-1;
   m=sqrt(n);
   for(i=2;i<=m;i++)
   {
       if(n%i==0)
       {
           x=n/i;
           y=n-x;
           break;
       }
   }
   printf("%lld %lld\n",x,y);
}

int main()
{
    int t ;
    scanf("%d",&t);
    while(t--)
       joss_joss();
}

#include<stdio.h>
#include<math.h>

int main()
{
    int t;
    long int n,a,b;
    scanf("%d",&t);
    for( ; t ;t--)
    {
        scanf("%ld",&n);
        if(n%2)
        {
            b=sqrt(n);
            for(a=3;a<=b;a++)
                if(n%a==0)
                    break;
            if(n%a)
                printf("1 %ld\n",n-1);
            else
                printf("%ld %ld\n",n/a,n-n/a);
        }
        else
            printf("%ld %ld\n",n/2,n/2);
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long int n,i,j,k,t;
    scanf("%lld",&t);
    while(t>0)
    {
        scanf("%lld",&n);
        long long int maxf=1;
        for(i=2;i<=sqrt(n);i++)
        {
            if(n%i==0)
            {
                long long int num=(n/i);
                if(num>maxf)
                maxf=num;
            }
        }
        long long int num=(n/maxf);
        long long int pum1=maxf*(num-1),pum2=maxf;
        printf("%lld %lld\n",pum2,pum1);
        t--;
    }
}

#include<stdio.h>
#include<math.h>
int main(){long long int t,i,j,n,c;
    scanf("%lld",&t);
    for(i=0;i<t;i++)
    {
        scanf("%lld",&n);
        c=0;
        for(j=2;j<=sqrt(n);j++)
        {
            if(n%j==0)
            {c++;
                break;}
        }
        if(c==1)
        {
            printf("%lld %lld\n",n/j,n-n/j);
        }
        else if(c==0)
        {
            printf("1 %lld\n",n-1);
        }
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(LL i=(l);i<(r);i+=(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a, LL n, int m) { LL x = 1; for (a %= m; n; n /= 2)n & 1 ? x = x * a % m : 0, a = a * a % m; return x; }
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x,i,j,c=0;x=n;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
//snippet

#define N 100009

int main() {
	int t;
	scanf("%d", &t);
	while (t--) {
		LL n;
		scanf("%lld", &n);
		if (n % 2 == 0)printf("%lld %lld\n", n / 2, n / 2);
		else {
			LL i, a[N], c = 0, x = n;
			LL l = n - 1;
			for (i = 1; i * i <= x; i++) {
				if (x % i == 0) {
					a[c++] = i;
					x /= i;
					a[c++] = x;
				}
			}
			sortupLL(a, c);
			LL ansA = 1;
			Rep(i,1,c-1){
				LL A = a[i];
				LL L = A / gcd(A, n - A) * (n - A);
				if (L < l) {
					l = L; ansA = A;
				}
			}
			printf("%lld %lld\n", ansA, n - ansA);
		}
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,n;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
            {
                printf("%d ", n/2);
                printf("%d\n", n/2);
            }
            else
            {
                for(i=3; i<=sqrt(n); i++)
                {
                    if(n%i==0)
                        break;
                }
                if(i>sqrt(n))
                {
                    printf("1 ");
                    printf("%d\n", n-1);
                }
                else
                {
                    printf("%d ", n/i);
                    printf("%d\n", n-n/i);
                }
            }
        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
            {
                printf("%d ", n/2);
                printf("%d\n", n/2);
            }
            else
            {
                for(i=3; i<=sqrt(n); i++)
                {
                    if(n%i==0)
                        break;
                }
                j=i;
                k=sqrt(n);
                if(i>sqrt(n) && n%k!=0)
                {
                    printf("1 ");
                    printf("%d\n", n-1);
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d\n", n-n/j);
                }
            }

        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d\n", n/2);

                }
            else{

            for(i=3; i<=sqrt(n); i++)
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i;
                k=sqrt(n);
                if(i>sqrt(n) && n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d ", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
            {
                printf("%d ", n/2);
                printf("%d\n", n/2);
            }
            else
            {
                for(i=3; i<=sqrt(n); i++)
                {
                    if(n%i==0)
                        break;
                }
                j=i;
                k=sqrt(n);
                if(i>sqrt(n))
                {
                    printf("1 ");
                    printf("%d\n", n-1);
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d\n", n-n/j);
                }
            }

        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d\n", n/2);

                }
            else{

            for(i=3; i<=sqrt(n); i++)
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i;
                k=sqrt(n);
                if(i>sqrt(n) && n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
    int t,n,a,b,i,j,k;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        if(n%2==0){
            printf("%d %d\n",n/2,n/2);
        }
        else if(prime(n)==1)
        {
            printf("1 %d\n",n-1);
        }
        else{k=3;
            for(j=3; j*j<n; j++)
            {
                if(n%j==0)
                {
                    a=n/j;
                    if(a>=k) k=a;
                }
            }
            b=n-k;
            printf("%d %d\n",k,b);
        }
    }
}
int prime(int x)
{
    int p;
    for(p=2; p<=sqrt(x); p++)
    {
        if(x%p==0)
            return 0;
    }
    return 1;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int q;
   scanf("%d",&q);
   while(q--)
   {
   long long int n,k,i,f=0;
   scanf("%lli",&n);
   if(n%2==0)
   {
       printf("%lli %lli\n",n/2,n/2);

   }
   else
   {
       for(i=3;i<=sqrt(n);i=i+2)
       {
           if(n%i==0)
           {k=(n/i>i)?n/i:i;
               f=1;
               printf("%lli %lli\n",k,n-k);
               break;
           }}
           if(f==0)
           {
               printf("%d %lli\n",1,n-1);
           }

   }
}
}

#include <stdio.h>

int main(){
	int t, n, i;
	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		//2
		i = 2;
		while(n % i != 0 && i * i <= n){
			i++;
		}
		if(i * i > n){
			printf("%d %d\n", 1, n - 1);
		}
		else{
			printf("%d %d\n", n / i, n / i * (i - 1));
		}
	}

	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	long long int i,n,t,j,c,d,e,k,count;
	scanf("%lld",&t);
	for(i=0;i<t;i++)
	{
		scanf("%lld",&n);
		count=0;
		if(n%2==0)
		printf("%lld %lld\n",n/2,n/2);
		else
		{
			c=sqrt(n);
			for(j=3;j<=c;j++)
			{
				if(n%j==0)
				{
					count++;
					break;
				}
			}
			k=j;
			if(count==1)
			{
				e=n/k;
				d=n-e;
				printf("%lld %lld\n",e,d);
			}
			else
			{
				printf("1 %lld\n",n-1);
			}
	    }
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
main()
{
	long long int t,n,a,b,c,l,k,p;
	scanf("%lld",&t);
	while(t>0)
{		long long int n1,m;
		scanf("%lld",&n);
		m=sqrt(n);
		if(n==1) {printf("%lld %lld\n",n,n);goto j;}
		else if(n%2==0) {printf("%lld %lld\n",n/2,n/2);goto j;}
		else for(c=3;c<=m;c=c+2)
	{
	if(n%c==0) {	n1=n/c;printf("%lld %lld\n",(n1*(c-1)),n1);goto j;	}
   // for(p=1;p<=c;p++) printf("w[%d]=%d\n",p,w[p]);
//	for(p=1;p<=c;p++) printf("x[%d]=%d\n",p,x[p]);
	}
	printf("1 %lld\n",n-1);
		j: t--;
}
}

#include<stdio.h>
#include<math.h>
int main()
{
    long long int t,i,n,k,l;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        l=sqrt(n);
        k=0;
        for(i=2;i<=l;i++)
        {
            if(n%i==0)
            {
                k=1;
                break;
            }
        }
        if(k==0)printf("%d %lld\n",1,n-1);
        else
        {
             i=n/i;
                printf("%lld %lld\n",i,n-i);

        }

    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int T;
    scanf("%d",&T);
    while(T>0)
    {
        long long int n , i  ;
        int found=0;
        scanf("%I64d",&n);
        i=2;
        while((i<=sqrt(n)) && (!found))
        {
            if(n%i==0) found=1;
            else i++;
        }
        if(found) printf("%I64d %I64d\n",n/i,n-(n/i));
        else printf("1 %I64d\n",n-1);

        T--;
    }
    return 0;
}

# include <stdio.h>
# include <math.h>
int main(void)
{
	long long int t,i;
	scanf("%lld",&t);
	for (i=1;i<=t;++i)
	{
		long long int n;
		scanf("%lld",&n);
		long long int j,k=0,m;
		m=sqrt(n);
		//printf("%lld\n",m);
		for (j=2;j<=m;++j)
		{
			if (n%j==0)
			{
				k=1;
				break;
			}
		}
		if (k==0)
		{
			printf("1 %lld\n",n-1);
		}
		else
		{
			printf("%lld %lld\n",n/j,n-(n/j));
		}
	}
	return(0);
}

#include<stdio.h>
int solve(int  n)
{
	int i;
	for (i = 2; i * i <= n; i++)
		if (n % i == 0)
			return n / i;
	return 1;
}
int main()
{
	int t;
	scanf("%d", &t);
	int n, m;
	for (; t > 0; t--)
	{
		scanf("%d", &n);
		if (n % 2 == 0)
			printf("%d %d\n", n / 2, n / 2);
		else
		{
			m = solve(n);
			printf("%d %d\n", m, (n / m - 1) * m);
		}
	}
	return 0;
}

#include <stdio.h>

int main()
{
	int t, n, i;
	scanf("%d", &t);
	while (t--)
	{
		scanf("%d", &n);
		i = 2;
		while (n % i != 0 && i * i <= n)
		{
			i++;
		}
		if (i * i > n)
		{
			printf("%d %d\n", 1, n - 1);
		}
		else
		{
			printf("%d %d\n", n / i, n / i * (i - 1));
		}
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int min(int a, int b){
    if(a <= b)
        return a;
    return b;
}

void solve(int n){
    int root = floor(sqrt(n));
    for(int i = 2; i<=root; i++){
        if(n%i==0){
            int a = n/i;
            printf("%d %d\n",a,n-a);
            return;
        }
    }
    printf("%d %d\n",1,n-1);
}

int main(){
    int t;
    scanf("%d",&t);
    for(int i =0; i<t; i++){
        int n;
        scanf("%d",&n);
        solve(n);
    }
    return 0;
}

#include<stdio.h>

int main()
{
    long long int t, n, i, r, p, q, c;
    scanf("%lld", &t);
    while(t--)
    {
        scanf("%lld", &n);
        if(n%2==0)
            printf("%lld %lld\n", n/2, n/2);
        else
        {
            r=sqrt(n)+1;
            c=0;
            for(i=2;i<=r;i++)
            {
                if(n%i==0)
                {
                    p=n/i;
                    q=n-p;
                    c++;
                    if(q==0)
                    {
                        q=n-1;
                        p=1;
                    }
                    printf("%lld %lld\n", p, q);
                    break;
                }
            }
            if(c==0)
                printf("1 %lld\n", n-1);
        }

    }
    return 0;
}

#include<stdio.h>
int prime(int a)
{
int f=0;
for(int i=2;i<=sqrt(a);i++)
{
if(a%i==0)
{
f=1;
break;
}
}
if(f==1) return 0;
else return 1;
}
int gcd(int a,int b)
{
if(b==0) return a;
else return gcd(b,a%b);
}
int main()
{
    /*int n;
    scanf("%d",&n);
    int a=sqrt(n);
    printf("%d",a);*/

    int t;
    scanf("%d",&t);
    while(t--)
    {
    int n;
    scanf("%d",&n);
    if(n%2==0)
    printf("%d %d\n",n/2,n/2);
    else
    {
    int check=prime(n);
    if(check==1)
    printf("1 %d\n",n-1);
    else
    {
    for(int i=2;i<=sqrt(n);i++)
    {
    if(n%i==0)
    {
    int k=n/i;
    printf("%d %d\n",k,n-k);
    break;
    }
    }

    }
    }
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define max(x,y) x > y ? x : y

int main() {
    long long int i,t,n,maximum;
    scanf("%lld",&t);
    while(t--){
        maximum = -999;
        scanf("%lld",&n);
        if(n % 2 == 0){
            printf("%lld %lld\n",n /2,n / 2);
            continue;
        }
        else{
            for(i = 1; i <= sqrt(n) + 1; i++){
                if(n % i == 0){
                    if(maximum < i)
                        maximum = max(i,n / i);
                    if(maximum == n)
                        maximum = i;
                }
            }
            printf("%lld %lld\n",maximum,n - maximum);
        }
    }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int x,t,n,y,s;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        s=sqrt(n);
        for(x=2;x<=s;x++)
        {
            if(n%x==0)
            {
                y=n/x;
                printf("%d %d\n",y,y*(x-1));
                break;
            }
        }
        if(x==s+1)
        printf("1 %d\n",n-1);
    }
    return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
    int t, i, j;
    scanf ("%d", &t);
    while (t--) {
        int n, i;
        scanf ("%d", &n);
        if (n % 2 == 0) printf ("%d %d", n/2, n/2);
        else {
            int m = sqrt (n);
            for (i = 3; i <= m; i += 2) {
                if (n % i == 0) {
                    printf ("%d %d", n/i, n -(n/ i));
                    break;
                }
            }
            if (i > m) printf ("%d %d", 1, n-1);
        }
        printf ("\n");
    }
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main()
{
	long long int n,t,i,min,flag,a,b;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld",&n);
		if(n%2==0)
		{
			printf("%lld %lld\n",n/2,n/2);
		}
		else
		{
			flag=0,min=10e9+10;
			for(i=3;i<=sqrt(n);i=i+2)
			{
				if(n%i==0)
				{
					flag=1;
					a=i;
					b=n/i;
					if(a<n-a)
					{
						if(n-a<min)
						{
							min=n-a;
						}
					}
					else{
						if(a<min)
						{
							min=a;
						}
					}
					if(b<n-b)
					{
						if(n-b<min)
						{
							min=n-b;
						}
					}
					else{
						if(b<min)
						{
							min=b;
						}
					}
				}
			}
			if(flag==1)
			{
				printf("%lld %lld\n",n-min,min);
			}
			else{
				printf("1 %lld\n",n-1);
			}
		}
	}
}

#include<stdio.h>
#include<conio.h>
#include<math.h>

int main()
{
    long long i,n,t,p,a,b;
    scanf("%lld",&b);
    for(t=1; t<=b; t++)
    {
        scanf("%lld",&n);
        if(n%2==0)
        {
            printf("%lld %lld\n",n/2,n/2);
        }
        else{
            p=(int)sqrt(n);
            for(i=3;i<=p+2;i=i+2){
                if(n%i==0){
                    a=n/i;
                    printf("%lld %lld\n",a,(n-a));
                    break;
                }
                else if(i>p){
                    printf("%d %lld\n",1,(n-1));
                    break;
                }
            }
        }
    }
    return 0;
}

#include<stdio.h>
#include<math.h>

int main(){
    int t,n;
    int i,flag=0,a=0,b=0;
    scanf("%d",&t);
    while(t--){
        flag=0;
        a=0;
        b=0;
      scanf("%d",&n);

      for(i=2;i<=sqrt(n);i++){
          if(n%i==0){
              flag=1;
              b=i-1;
              a=n/i;
              break;
          }
      }
      if(flag==1){
          printf("%d %d",a,a*b);
      }

      else{
       printf("%d %d",1,n-1);
    }

    printf("\n");
    }
    return 0;
}

#include<stdio.h>
int main()
{
    int t,k;
    scanf("%d",&t);
    long long int n,i,min;
    for(k=1;k<=t;k++)
    {
        scanf("%lld",&n);
        min=n-1;
        for(i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                if(min>=(n-(n/i)))
                {
                    min=n-(n/i);
                }
                else
                {
                    min=n-1;
                }
                break;
            }
        }
        printf("%lld %lld\n",(n-min),min);
    }
    return 0;
}

#include<stdio.h>
int main()
{
        long long int t,n,i,j,factor;
        scanf("%lld",&t);
        for(i=0;i<t;i++)
        {
                scanf("%lld",&n);
		factor=n;
		for(j=2;j*j<=n;j++)
		{

			if(n%j==0)
			{
				factor=j;
				break;
			}
		}
	 	printf("%lld %lld\n",(factor-1)*n/factor,n/factor);

        }
}

#include <stdio.h>

#define in32(x) scanf("%d", &x)
#define out32(x) printf("%d", x)

int main() {
    int t, n, i;
    in32(t);
    while(t--) {
        in32(n);
        i = 2;
        while (n%i && i * i <= n) i++;
        if ((n%i)) {
            i = n;
        }
        printf("%d %d\n", n / i, n - n / i);
    }
    return 0;
}

#include<stdio.h>
#include<limits.h>
#include<stdlib.h>
/*long long int min(long long int a,long long int b)
{
    if(a>b)
    return b;
    else
    return a;
}
long long int LCM(long long int a,long long int b)
{
    long long int i;
    for(i=b;;i+=b)
    {
        if(i%a==0)
        {
            return i;
        }
    }
}*/
int main()
{
    int t;int i;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {int z=0;
        long long int n=0,m=LLONG_MAX,a=0,j;
        scanf("%lld",&n);
        if(n%2==0)
        {
            printf("%lld %lld \n",n/2,n/2);
            continue;
        }
        else
        {
            for(j=2;j*j<=n;j++)
            {
                if(n%j==0)
                {
                    /*long long int y=LCM(j,n-j);
                    m=min(m,y);
                    if(m==y)
                    {
                        a=j;
                    }*/
                    printf("%lld %lld \n",n/j,n-(n/j));
                    z=-1;
                    break;
                }
            }
            if(z==0){
            j=1;
            printf("%lld %lld \n",j,n-j);
            }

        }
    }
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int smallestDivisor(int n)
{
    // if divisible by 2
    if (n % 2 == 0)
        return 2;

    // iterate from 3 to sqrt(n)
    for (int i = 3; i * i <= n; i += 2) {
        if (n % i == 0)
            return i;
    }

    return n;
}

int main(){
    int t;
    scanf("%d",&t);
    while(t--)
    {
       int n,n1,cnt=0;
       scanf("%d",&n); n1=n;
       int s=smallestDivisor(n);
         if(s==n) { printf("1 %d\n",(n-1));  continue; }

        n1=n/s;
        printf("%d %d\n",n1,((s-1)*n1));

    }
    return 0;
}

//Jidan Al Abrar
#include<stdio.h>
int main()
{
    long long n,x,y,k,i,t;
    scanf("%lld",&t);
    while(t--){
    scanf("%lld",&n);
        x=1;
        y=n-1;
        k=sqrt(n);
        for(i=2;i<=k;i++)
        {
            if(n%i==0)
            {
               x=n/i;
               y=n-x;
               break;
            }
        }

        printf("%lld %lld\n",x,y);
    }
    return 0;
}

#include<stdio.h>
int f(int  n)
{
	int i;
	for (i = 2; i * i <= n; i++)
		if (n % i == 0)
			return n / i;
	return 1;
}
int main()
{
	int t;
	scanf("%d", &t);
	int n, m;
	for (; t > 0; t--)
	{
		scanf("%d", &n);
		if (n % 2 == 0)
			printf("%d %d\n", n / 2, n / 2);
		else
		{
			m = f(n);
			printf("%d %d\n", m, (n / m - 1) * m);
		}
	}
	return 0;
}

#include <stdio.h>
#include <math.h>

int main()
{
    long long t, i, n, j, m;

    scanf("%lld", &t);

    for (i = 0; i < t; i ++) {
        scanf("%lld", &n);

        if (n & 1) {
            int root = sqrt(n);
            int flag = 0;

            for (j = 3; j <= root + 2; j += 2) {

                if (n % j == 0) {
                    m = n / j;
                    printf("%lld %lld\n", m, (n-m));
                    flag = 1;
                    break;
                }
            }
            if (flag == 0) printf("1 %lld\n", n-1);
        }

        else {
                n = n / 2;
            printf("%lld %lld\n", n, n);
        }
    }
}

#include<stdio.h>
#include<math.h>
int prime(long int x)
{int flag=0;
 for(int i=2;i<=sqrt(x);i++)
 {
  if(x%i==0)
  {
   flag=1;
   break;
  }
 }
 if(flag==1)
 return 0;
 else
 return 1;

}
int main()
{
 int t;
 scanf("%d",&t);
 while(t--)
 {
  long int n;
  scanf("%ld",&n);

  if(n%2==0)
  printf("%ld %ld\n",n/2,n/2);
  else
  {
   if(prime(n))
   printf("1 %ld\n",n-1);
   else
   {long int k;
    for(int i=3;i<=sqrt(n);i++)
    {
     if(n%i==0)
     {k=n/i;
      break;
     }
    }
    long int h=n/k;
    printf("%ld %ld\n",k,(h-1)*k);

   }
  }
 }
 return 0;
}

#include <stdio.h>
#include <math.h>

int prime(int num){
	for(int i = 2; i <= sqrt((double)num); i++){
		if(num%i == 0)
			return i;
	}

	return 1;
}

int main(int arg, char* argv){
	int cases;
	int num;
	int div;
	scanf("%d", &cases);

	while(cases--){
		scanf("%d", &num);
		if(num%2 == 0){
			printf("%d %d\n", num/2, num/2);
		}
		else if(num%3 == 0){
			printf("%d %d\n", num/3, (2*num)/3);
		}
                else if((div = prime(num)) == 1){
                        printf("%d %d\n", 1, num-1);
                }
		else{
			printf("%d %d\n", num/div, (num-num/div));
		}
	}

	return 0;
}

#include<stdio.h>
int dasqrt(int a){
int i=1;
while(1){
    if(i*i>=a)break;
    i++;
}
return i;
}

int minyinshu(int a){
int i=2;
int s=dasqrt(a);
while(1){
    if(a%i==0){break;}
    if(i>s+1){i=a;break;}
    i++;
}
return i;
}

int main(){
int num,numx,n,my;
scanf("%d",&num);
for(numx=1;numx<=num;numx++){
  scanf("%d",&n);
  my=minyinshu(n);
  if(my==n)
    printf("%d %d\n",1,n-1);
  else{
    printf("%d %d\n",n/my,n-n/my);
  }
}
return 0;
}

#include <stdio.h>
typedef long long int ll;
int checkprime(int n){
    for(int i=2;i<=n/i;i++)
    {
        if(n%i==0)
        return n/i;
    }
    return -1;
}
int main()
{
    int n,t;
    scanf("%d",&t);
    while(t--){
    scanf("%d",&n);
    if(checkprime(n)==-1)printf("1 %d\n",n-1);
    else
    {
        int x=checkprime(n);
        printf("%d %d\n",x,(n-x));
    }
    }
}

#include <stdio.h>
#include<math.h>

int main()
{
	int t;
	scanf("%d",&t);
	for (int i=1; i<=t; i++){
        int n;
        scanf("%d",&n);
        if (n%2==0){
            printf("%d %d\n",n/2,n/2);
        }
        else {
            int limit=sqrt(n+1);
            int x=0;
            for (int j=2; j<=limit; j++){
                if (n%j==0){
                    int y=n/j;
                    if ((n-y)%y==0){
                        printf("%d %d\n",y,n-y);
                        x=1;
                        break;
                    }
                    else{
                        printf("%d %d\n",j,n-j);
                        x=1;
                        break;
                    }
                }
            }
            if (x==0){
                printf("1 %d\n",n-1);
            }
        }
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
unsigned long long int minlcm(unsigned long long int n );
int main ()
{

unsigned long long int n,t,i,j;
scanf("%llu",&t);
 for(i=1 ;i<=t ;i++)
 {
     scanf("%llu",&n);
     if (n%2==0) printf("%llu %llu\n",n/2 ,n/2);

     else minlcm(n);

 }

}

unsigned long long int minlcm(unsigned long long int n )
{
  unsigned long long int  a,i;
  for(i=2;i<= sqrt(n) ;i++)
  {
     if(n%i==0)
        {
            a=n/i;
            printf("%llu %llu \n",a,n-a);
            return 0;
        }

  }

    printf("%d %llu \n",1, n-1);
    return 0;

}

#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<math.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int n,i,k,j,m,x,y;
        scanf("%lld",&n);
        x=1;
        y=n-1;
        k=sqrt(n);
        for(i=2;i<=k;i++)
        {
            if(n%i==0)
            {
               x=n/i;
               y=n-x;
               break;
            }
        }
        printf("%lld %lld\n",x,y);
    }
    return 0;
}

#include <stdio.h>

int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    long long d = n;
    for (long long i = 2; i*i <= n; i ++) {
      if (n % i == 0) {
        d = i;
        break;
      }
    }
    long long a = n*(d-1)/d, b = n-a;
    printf("%lld %lld\n", b, a);
  }

  return 0;
}

#include <stdio.h>
#include <math.h>
int n, t, gd;

int greatestdivisor(int n)
{
    for (int i = 2; i <= sqrt(n); i++)
        if (n % i == 0) return n / i;
    return 1;
}
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &t);
        gd = greatestdivisor(t);
        printf("%d %d\n", gd, t - gd);
    }
    return 0;
}

#include <stdio.h>

int main(){
	int t, n, i;
	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		//2
		i = 2;
		while(n % i != 0 && i * i <= n){
			i++;
		}
		if(i * i > n){
			printf("%d %d\n", 1, n - 1);
		}
		else{
			printf("%d %d\n", n / i, n / i * (i - 1));
		}
	}

	return 0;
}

#include <stdio.h>

int main()
{
	int t; scanf("%d",&t);
	while(t--)
	{
		int n,p; scanf("%d",&n); p=n;
		for(int i=2; i*i<=n; i++) if(n%i==0)
		{
			p=i; break;
		}
		printf("%d %d\n",n/p,n-n/p);
	}
	return 0;
}

#include<stdio.h>

long long smp(long long n)
{
    long long i;
    if(n%2 == 0) return 2;
    for(i = 3; i*i <= n; i+=2)
    {
        if(n%i == 0) return i;
    }
    return n;
}

int main()
{
	long long n, t;
	scanf("%lld", &t);
	while(t--){
		scanf("%lld", &n);
		long long s = smp(n);
		//printf("%lldAA\n", s);
		printf("%lld %lld\n", n/s, (n*(s-1))/s);
	}
	return 0;
}

#include <stdio.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,count=0;
        scanf("%d",&a);
        for(int i=2;i<=10000000;i++)
        {
            if(a%i==0 && a/i!=1)
            {
                printf("%d %d\n",(a/i),(i-1)*(a/i));
                count++;
                break;
            }
        }
        if(count==0)
        {
            printf("1 %d\n",a-1);
        }
        count=0;
    }

    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int n,i,k,j,m,x,y;
        scanf("%lld",&n);
        x=1;
        y=n-1;
        k=sqrt(n);
        for(i=2;i<=k;i++)
        {
            if(n%i==0)
            {
               x=n/i;
               y=n-x;
               break;
            }
        }
        printf("%lld %lld\n",x,y);
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int t;
    scanf("%d",&t);
    int i;
    for(i=0;i<t;i++)
    {
      int n,m,j,u=0;
      scanf("%d",&n);
      if(n%2==0)
      {
          printf("%d %d\n",n/2,n/2);
          continue;
      }
      j=3;
      while(j<=sqrt(n))
      {
          if(n%j==0)
          {
              u++;
            break;
          }
          j++;
      }
      if(u==0)
        printf("1 %d\n",(n-1));
      if(u==1)
        printf("%d %d\n",n/j,((j-1)*(n/j)));
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
main()
{
	  int t,n,*a,i,m;
	scanf("%d",&t);
	while(t--)
	{   int flag=0,min,g=0,p=0;
		//a=( int*)calloc(n,sizeof( int));
		scanf("%d",&n);
		if(n%2==0)
		{
			printf("%d %d",n/2,n/2);
		}
		else
		{
			for(i=2;i<=sqrt(n);i++)
			{
				if(n%i==0)
				{
					m=n/i;
					flag=1;
					break;
				}
			}
			if(flag==0)
			{
				printf("1 %d",n-1);
			}
			else
			{
				printf("%d  %d",m,n-m);
			}
		}
			printf("\n");
	}

	}

#include <stdio.h>
int main()
{
    int i,j,t;
    scanf("%d",&t);
    while(t--)
    {
        int n,flag=0;
        scanf("%d",&n);
        if(n%2==0)
        {
            printf("%d %d\n",n/2,n/2);

        }
        else
        {
            for(i=3;i<=sqrt(n);i++)
            {
                if(n%i==0)
                {
                    printf("%d %d\n",n/i,n-(n/i));
                    flag = 1;
                   break;
                }
            }
            if(flag==0)
            {
                printf("1 %d\n",n-1);
            }
        }
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

void depression() {
	long long int  n,i;

		scanf("%lld", &n);

		if (n % 2 == 0) {
			printf("%lld %lld\n", n / 2, n / 2);
		}
		else {
			for (i = 2; i * i <= n; i++) {
				if (n % i == 0) {
					printf("%lld %lld\n", n / i, n-(n/i));
					return;
				}
			}
			printf("1 %d\n", n - 1);
		}
	}
int main() {
	long long int t;
	scanf("%lld", &t);
	while (t--) {
		depression();
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
    int q;
   scanf("%d",&q);
   while(q--)
   {
   long long int n,k,i,flag=0;
   scanf("%lli",&n);
   if(n%2==0)
   {
       printf("%lli %lli\n",n/2,n/2);

   }
   else
   {
       for(i=3;i<=sqrt(n);i=i+2)
       {
           if(n%i==0)
           {k=(n/i>i)?n/i:i;
               flag=1;
               printf("%lli %lli\n",k,n-k);
               break;
           }}
           if(flag==0)
           {
               printf("%d %lli\n",1,n-1);
           }

   }
}
}

#include <stdio.h>
#include <math.h>
int maxp(int n)
{
    int q=0;
    for(int i=3;i<=sqrt(n);i=i+2)
    {
        if(n%i==0)
        {
            q=n/i;
            break;
        }
    }
    if(q==0)
    {
        return 1;
    }
    else
        return q;
}
int main() {
	//code
		int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++)
	{
	    int n,a,b;
	    scanf("%d",&n);
	    if(n%2==0)
	    {
	        printf("%d %d\n",n/2,n/2);
	    }
	    else
	    {
	        a=maxp(n);
	        int b=n-a;
	        printf("%d %d\n",a,b);
	    }
	}
	return 0;
}

#include<stdio.h>
int main()
{
    long long int t,n,i,a=0,j;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        a=0;
        if(n%2==0)
            {
                printf("%lld %lld\n",n/2,n/2);
            }
            else
            {
              for(i=3;i*i<=n;i++)
              {
                if(n%i==0)
                {
                    a=1;
                    break;
                }

              }
              if(a==1)
              {
                  printf("%lld %lld\n",n/i,n-(n/i));
              }
              else
              {
                  printf("1 %lld\n",n-1);
              }

            }
        }
    return 0;
}

#include<stdio.h>
#include<math.h>
int is_prime(int n)
{
    int x=sqrt(n);
    int flag=0;
    if(n<2){
        return 0;
    }
    else if(n==2){
        return 1;
    }
    else {
        if(n%2==0){
            return 0;
        }
        else{
            for(int i=3;i<=x+1;i+=2){
                if(n%i==0){
                    return i;
                    break;
                }
            }
        }
    }
    return 1;
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--){
        int n;
        scanf("%d",&n);
        if(n%2==0){
            printf("%d %d\n",n/2,n/2);
        }
        else if(n%3==0){
            printf("%d %d\n",n/3,(2*n)/3);
        }
        else {
            int prime=is_prime(n);
            if(prime==1){
                printf("%d %d\n",1,n-1);
            }
            else{
                printf("%d %d\n",n/prime,(n-(n/prime)));
            }
        }
    }
    return 0;
}

    #include<stdio.h>
    #include<string.h>
    #include<conio.h>
    #include<math.h>
    int main()
    {
        int t;
        scanf("%d",&t);
        while(t--)
        {
            long long int n,i,k,j,m,ans,ans1;
            scanf("%lld",&n);
            ans=1;
            ans1=n-1;
            k=sqrt(n);
            for(i=2;i<=k;i++)
            {
                if(n%i==0)
                {
                   ans=n/i;
                   ans1=n-ans;
                   break;
                }
            }
            printf("%lld %lld\n",ans,ans1);
        }
        return 0;
    }

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    int t;
    scanf("%d",&t);
    for(int q=0;q<t;q++)
    {
        long long int n;
        scanf("%lld",&n);
        if(n%2==0)
        {
            printf("%lld %lld",n/2,n/2);
        }
        else{
            long long int arr[100],x=0;
            long long int i=3,t=n;
            while(t!=1 && i<=sqrt(n))
            {
                if(t%i==0)
                {
                    arr[x]=i;
                    x++;
                    t/=i;
                    printf("%lld %lld",t,n-t);
                    break;
                }
                else{
                    i+=2;
                }
            }
            if(t==n)
            {
                printf("1 %lld",n-1);
            }
    }
    printf("\n");
    }
    return 0;
}

#include<stdio.h>

int main()
{
    int t,x,i,p,q,j,a,b,c,d,f;

    scanf("%d",&t);

    while(t--)
    {
        scanf("%d",&x);

        if(x%2==0)
        {
            printf("%d %d\n",x/2,x/2);

            continue;
        }

        f=0;
        for(i=2;i*i<=x;i++)
        {
            if(x%i==0)
            {
                p=x/i; f=1; break;
            }
        }

        if(f)
        {
            q=x-p;
        }
        else
        {
            p=1; q=x-p;
        }

        printf("%d %d\n",p,q);
    }
}

#include<stdio.h>
int main()
{
    long long t,n,i,p,d;
    scanf("%lld",&t);
    while(t--)
    {
       p=0;
       scanf("%lld",&n);
       if(n%2==0)
       {
           printf("%lld %lld\n",n/2,n/2);
           continue;
       }
       else
       {
           for(i=3;i*i<=n;i++)
           {
               if(n%i==0)
               {
                   d=n/i;
                   p=1;
                   break;
               }
           }
           if(p==1)
                printf("%lld %lld\n",d,n-d);
           else
                printf("1 %lld\n",n-1);
       }
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	int t, n, x, i;

	scanf("%d", &t);

	while(t--)
	{
		scanf("%d", &n);
		int f=0;

		if(n%2==0)
		{
			printf("%d %d\n", n/2, n/2);
		}
		else
		{
			for(i=3; i<=sqrt(n); i+=2)
			{
				if(n%i==0)
				{
					printf("%d %d\n", n/i, n-(n/i));
					f=1; break;
				}
			}
			if(f==0){
				printf("1 %d\n", n-1);
			}
		}
	}
	return 0;
}

#include <stdio.h>
int main()
{
    int t, n, i, j, x, y, z;
    scanf("%d", &t);
    while(t--)
    {
        scanf("%d", &n);

        if(n%2==0)
            printf("%d %d\n", n/2, n/2);
        else
        {
            x=0;
            for(i=3;i*i<=n;i=i+2)
            {
                if(n%i==0)
                {
                    x=i;
                    break;
                }
            }
            if(x==0) printf("%d %d\n", 1, n-1);
            else
            {
                for(i=3;i<=n;i++)
                {
                    x=n/i;
                    if(x*i==n) break;
                }
                printf("%d %d\n", x, n-x);
            }
        }
    }
    return 0;
}

#include <stdio.h>
#include <math.h>

int n, t, k;

int proper (int n)
{
    int i = 2;
    int r = (int)(sqrt(n) + 1);
    for (i = 2; i <= r; i++)
        if (n % i == 0) return n / i;
    return 1;
}

int main()
{
    scanf("%d", &t);
    for (int i = 1;  i <= t; i++)
    {
        scanf("%d", &n);
        k = proper (n);
        printf ("%d %d\n", k, n - k);
    }
    return 0;
}

/*

*/

#include <stdio.h>
#include <stdlib.h>

int main(){
  int casos, n, i, d;

  scanf("%d", &casos);

  while(casos--){
    scanf("%d", &n);

    for(d = -1, i = 2; i * i <= n; ++i){
      if(n % i == 0){
	d = i;
	break;
      }
    }

    if(d == -1)
      printf("1 %d\n", n - 1);
    else
      printf("%d %d\n", n / i, n - (n / d));
  }

  return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <limits.h>
typedef long long ll;

ll MAX = -100000000000;                      //  1e11
ll MIN = 100000000000;                     // -1e11
ll MOD = 1000000007;

ll longlongmax = __LONG_LONG_MAX__;

ll maxormin(ll a,ll b,ll flag){
    return flag==1?(a>b?a:b):(a<b?a:b);
}

ll overflowcheck(ll a){
    if(a==1){
        return 0;
    }
    else
    {
        ll temp = a;
        ll power = 1;
        while( longlongmax/temp>a ){
            temp *= a;
            power++;
        }
        return power+1;                     // Overflow occurs at this power.
    }

}

ll merge(ll A[],ll B[],ll left,ll mid,ll right){
    ll count = 0;
    ll n1 = mid-left+1;
    ll n2 = right-mid;

    ll LA[n1],LB[n1],RA[n1],RB[n2];

    for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}
    for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}

    ll i=0,j=0,k=left;

    while(i<n1&&j<n2){
        if(LA[i]<RA[j]){
            A[k] = LA[i];
            B[k] = LB[i];
            i++;
        }
        else{
            A[k] = RA[j];
            B[k] = RB[j];
            count += n1-i;
            j++;
        }
        k++;
    }
    while(i<n1){
            A[k] = LA[i];
            B[k] = LB[i];
            i++;
            k++;
    }

    while(j<n2){
            A[k] = RA[j];
            B[k] = RB[j];
            j++;
            k++;
    }
    return count;
}

ll mergesort(ll A[],ll B[],ll left,ll right){
    ll total = 0;
    if(left<right){
        ll mid = (right-left)/2+left;
        total += mergesort(A,B,left,mid);
        total += mergesort(A,B,mid+1,right);
        total += merge(A,B,left,mid,right);
    }
    return total;
}

ll primemarked[3000000];
ll primearray[3000000];
ll primeind;

void setupprimes()
{
    for (ll i = 2; i < 3000000; i++)
    {
        for (ll j = 2*i; j < 3000000; j+=i)
        {
            primemarked[j] = 1;
        }
    }
    for (ll i = 2; i < 3000000; i++)
    {
        if(!primemarked[i])
        {
            primearray[primeind++] = i;
        }
    }
}

int main(int argc, char const *argv[])
{
    setupprimes();
    ll T = 1;
    scanf("%lld",&T);
    for(ll t = 0; t < T; t++)
    {
        ll N ;
        scanf("%lld",&N);
        ll n = 2;
        ll key = 0;
        for(n = 2;n <= 1e6 ; n++)
        {
            if(N%n == 0){
                break;
            }
        }
        if(n == 1e6 + 1){
            printf("%d %lld\n",1,N-1);
        }
        else{
            MAX = N/n;
            ll k = n;
            printf("%lld %lld\n",(k-1)*MAX,MAX);
        }
    }

    return 0;
}

#include <stdio.h>
#include<math.h>
void solve(){
    int n;
    scanf("%d",&n);
    if(n%2==0)
    printf("%d %d\n",n/2,n/2);
    else{
        int i=3,temp=0;
        while(n%i!=0&&i<=sqrt(n)){
            i+=2;
            temp++;
        }
        int m;
        if(n%i==0)
        m=n/i;
        else
        m=1;
        printf("%d %d\n",m,n-m);
    }
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--){
        solve();
    }
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
//int a[123];
int main()
{
    int i,j,m,n,t;
    scanf("%d", &t);
    for(i=0;i<t;i++){
        scanf("%d", &n);
        int det=1;
        if(n%2==0)printf("%d %d\n", n/2,n/2);
        else{
            j=sqrt(n);
            //printf("%d ", j);
            for(;j>=1;j--){
                if(n%j==0&&j!=1)det=j;
            }
            if(det!=1)printf("%d %d\n", n/det,n-n/det);
            else printf("1 %d\n", n-1);
        }
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
void main()
{
 int t;
 scanf("%d",&t);
 while(t--)
{
long int n,s;
scanf("%ld",&n);
if((n%2)==0)
    printf("%ld %ld\n",n/2,n/2);
else
 {
  s=1;
  for(int i=2;i<=sqrt(n);i++)
  {
    if((n%i)==0)
    {
      s=(n/i);
      break;
    }
  }
  printf("%ld %ld\n",s,n-s);
 }
}
}

#include<stdio.h>
#include<math.h>
int main()
{
    int t;
    scanf("%d",&t);
    int i;
    for(i=0;i<t;i++)
    {
      int n,j;
      scanf("%d",&n);
      int a[n],c=0,m=0;
      for(j=0;j<n;j++)
        scanf("%d",(a+j));
      for(j=0;j<n;j++)
      {
          if(j+1==a[j])
          { a[j]=1;
            c++;
          }
      }
      if(c==n)
      {
          printf("0\n");
          continue;
      }
      for(j=0;j<n;j++)
      {
          if(a[j]==j+1)
            m++;
          else
            break;
      }
      if(j!=n-1)
      for(j=n-1;j>0;j--)
      {
          if(a[j]==j+1)
            m++;
          else
            break;
      }
      if(m==c)
      {
          printf("1\n");
          continue;
      }
      else
        printf("2\n");
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main() {
	long long int t, n, x, y,i;
	scanf("%lld", &t);
	while (t--) {
		scanf("%lld", &n);
		if (n % 2 == 0) {
			printf("%lld %lld\n", n / 2, n / 2);
		}
		else {
			for (i = 2; i * i <= n; i++) {
				if (n % i == 0) {
					printf("%lld %lld", n / i, n*(i-1)/i);
				}
			}
		}

	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    long long t,i,n,k,l;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        l=sqrt(n);
        for(i=l;i>=1;i--)
        {
            if(n%i==0)
            {
                i=n/i;
                printf("%lld %lld\n",i,n-i);
                break;
            }
        }

    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long t,i,n,k,l;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        l=1;
        for(i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                l=0;
                break;
            }
        }

       if(l==1)
        printf("%d %lld\n",1,n-1);
       else
       {
            if(n%2==0)
            {
                i=n/2;
                k=i;
            }
            else
            {
                i=n/3;
                k=2*i;
            }
        printf("%lld %lld\n",i,k);
       }
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long int t,n,i,a=0,j;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        a=0;
        if(n%2==0)
            {
                printf("%lld %lld\n",n/2,n/2);
            }
            else
            {
              for(i=3;i*i<=n;i++)
              {
                if(n%i==0)
                {
                    a=1;
                    break;
                }

              }
              if(a==1)
              {
                  printf("%lld %lld\n",i,n-i);
              }
              else
              {
                  printf("1 %lld\n",n-1);
              }

            }
        }
    return 0;
}

#include<stdio.h>
int main()
{
        long long int t,n,i,j,factor;
        scanf("%lld",&t);
        for(i=0;i<t;i++)
        {
                scanf("%lld",&n);
		factor=n;
		for(j=2;j*j<=n;j++)
		{

			if(n%j==0)
			{
				factor=j;
				break;
			}
		}
		printf("%lld\n",factor);
	 printf("%lld %lld\n",(factor-1)*n/factor,n/factor);

        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int t;
    scanf("%d",&t);
    int i;
    for(i=0;i<t;i++)
    {
      int n,m,j,u=0;
      scanf("%d",&n);
      if(n%2==0)
      {
          printf("%d %d\n",n/2,n/2);
          continue;
      }
      j=3;
      while(j<=sqrt(n))
      {
          if(n%j==0)
          {
              u++;
            break;
          }
          j++;
      }
      if(u==0)
        printf("1 %d\n",(n-1));
      if(u==1)
        printf("%d %d\n",n/j,((j-1)*n)/j);
    }
    return 0;
}

#include <stdio.h>
#include<math.h>
void solve(){
    int n;
    scanf("%d",&n);
    if(n%2==0)
    printf("%d %d\n",n/2,n/2);
    else{
        int i=3;
        while(n%i!=0&&i<=sqrt(n)){
            i+=2;
        }
        int m=n/i;
        printf("%d %d\n",m,n-m);
    }
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--){
        solve();
    }
}

#include<stdio.h>
int ami(int n)
{
    int i;
    int a,b,val=0;
    for(i=8; i<=1000; i++){
    if(n%i==0){
            a=n/i;
            b=n-a;
            printf("%d %d\n",a,b);
            val++;
         break;
    }
    }
    if(val==0){
        printf("%d %d\n",1,n-1);
  }
  //return a,b;
}
int main()
{
    int t;
    scanf("%d",&t);
    int i,a,b;
    int n;
    int min;
    for(i=0; i<t; i++){
       scanf("%d",&n);
        min=n;
        if(n%2==0){
                printf("%d %d\n",n/2,n/2);
        }
        else if(n%3==0){
        printf("%d %d\n",n/3,n-(n/3));
        }
        else if(n%5==0){
        printf("%d %d\n",n/5,n-(n/5));
        }
        else if(n%7==0){
        printf("%d %d\n",n/7,n-(n/7));
        }
    else{
            ami(n);
       //printf("%d %d\n",ami(n));
    }
  }
    return 0;
}

#include <stdio.h>
int main()
{
    int t, n, i, j, x;
    scanf("%d", &t);
    while(t--)
    {
        scanf("%d", &n);

        if(n%2==0)
            printf("%d %d\n", n/2, n/2);
        else
        {
            x=0;
            for(i=3;i*i<=n;i++)
            {
                if(n%i==0) x=i;
            }
            if(x==0) printf("%d %d\n", 1, n-1);
            else
            {
                printf("%d %d\n", x, n-x);
            }
        }
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    for(i=0; i<t; i++)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d ", n/2);
                    printf("\n");
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i-1;
                k=sqrt(n);
                printf("%d ", i);
                if(i>sqrt(n) && n%k!=0)
                {
                    printf("%d ", n/2);
                    printf("%d", n/2+1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d ", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>

int main()
{
    int t,x,i,p,q,j;

    scanf("%d",&t);

    while(t--)
    {
        scanf("%d",&x);

        if(x%2==0)
        {
            printf("%d %d\n",x/2,x/2);

            continue;
        }

        for(i=1;i*i<=x;i++)
        {
            if(x%i==0)
            {
                p=i; q=x-i;
            }
        }

        printf("%d %d\n",p,q);
    }
}

#include<stdio.h>
int main()
{
        long long int t,n,i,j,factor;
        scanf("%lld",&t);
        for(i=0;i<t;i++)
        {
                scanf("%lld",&n);
		for(j=2;j*j<=n;j++)
		{
			if(n%j==0)
			{
				factor=j;
				break;
			}
		}
		printf("%lld %lld\n",(factor-1)*n/factor,n/factor);
        }
}

#include<stdio.h>
int main()
{
	int t;
	scanf("%d", &t);
	int n, m;
	for (; t > 0; t--)
	{
		scanf("%d", &n);
		if (n % 2 == 0)
			printf("%d %d\n", n / 2, n / 2);
		else
		{
			m = 2;
			while (n % m > 0)
				m++;
			if (m != n)
				printf("%d %d\n", m, (n / m - 1) * m);
			else
				printf("%d %d", 1, n - 1);
		}
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <limits.h>
typedef long long ll;

ll MAX = -100000000000;                      //  1e11
ll MIN = 100000000000;                     // -1e11
ll MOD = 1000000007;

ll longlongmax = __LONG_LONG_MAX__;

ll maxormin(ll a,ll b,ll flag){
    return flag==1?(a>b?a:b):(a<b?a:b);
}

ll overflowcheck(ll a){
    if(a==1){
        return 0;
    }
    else
    {
        ll temp = a;
        ll power = 1;
        while( longlongmax/temp>a ){
            temp *= a;
            power++;
        }
        return power+1;                     // Overflow occurs at this power.
    }

}

ll merge(ll A[],ll B[],ll left,ll mid,ll right){
    ll count = 0;
    ll n1 = mid-left+1;
    ll n2 = right-mid;

    ll LA[n1],LB[n1],RA[n1],RB[n2];

    for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}
    for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}

    ll i=0,j=0,k=left;

    while(i<n1&&j<n2){
        if(LA[i]<RA[j]){
            A[k] = LA[i];
            B[k] = LB[i];
            i++;
        }
        else{
            A[k] = RA[j];
            B[k] = RB[j];
            count += n1-i;
            j++;
        }
        k++;
    }
    while(i<n1){
            A[k] = LA[i];
            B[k] = LB[i];
            i++;
            k++;
    }

    while(j<n2){
            A[k] = RA[j];
            B[k] = RB[j];
            j++;
            k++;
    }
    return count;
}

ll mergesort(ll A[],ll B[],ll left,ll right){
    ll total = 0;
    if(left<right){
        ll mid = (right-left)/2+left;
        total += mergesort(A,B,left,mid);
        total += mergesort(A,B,mid+1,right);
        total += merge(A,B,left,mid,right);
    }
    return total;
}

ll primemarked[3000000];
ll primearray[3000000];
ll primeind;

void setupprimes()
{
    for (ll i = 2; i < 3000000; i++)
    {
        for (ll j = 2*i; j < 3000000; j+=i)
        {
            primemarked[j] = 1;
        }
    }
    for (ll i = 2; i < 3000000; i++)
    {
        if(!primemarked[i])
        {
            primearray[primeind++] = i;
        }
    }
}

int main(int argc, char const *argv[])
{
    setupprimes();
    ll T = 1;
    scanf("%lld",&T);
    for(ll t = 0; t < T; t++)
    {
        ll N ;
        scanf("%lld",&N);
        ll n = 2;
        ll key = 0;
        for(n = 2;n*n <= N ; n++)
        {
            if(N%n == 0){
                break;
            }
        }
        if(n == 1e6 + 1){
            printf("%d %lld\n",1,N-1);
        }
        else{
            MAX = N/n;
            ll k = n;
            printf("%lld %lld\n",(k-1)*MAX,MAX);
        }
    }

    return 0;
}

#include<stdio.h>
#include<math.h>
int prime(long int x)
{int flag=0;
 for(int i=2;i<=sqrt(x);i++)
 {
  if(x%i==0)
  {
   flag=1;
   break;
  }
 }
 if(flag==1)
 return 0;
 else
 return 1;

}
int main()
{
 int t;
 scanf("%d",&t);
 while(t--)
 {
  long int n;
  scanf("%ld",&n);

  if(n%2==0)
  printf("%ld %ld\n",n/2,n/2);
  else
  {
   if(prime(n))
   printf("1 %ld\n",n-1);
   else
   {long int k;
    for(int i=sqrt(n);i>=1;i--)
    {
     if(n%i==0)
     {k=n/i;
      break;
     }
    }
    long int h=n/k;
    printf("%ld %ld\n",k,(h-1)*k);

   }
  }
 }
 return 0;
}

#include <stdio.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a;
        scanf("%d",&a);
        if(a%2==0)
        {
            printf("%d %d\n",a/2,a/2);
        }
        else if(a%3==0)
        {
            printf("%d %d\n",a/3,2*(a/3));
        }
        else
        {
            printf("1 %d\n",a-1);
        }
    }

    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int q;
   scanf("%d",&q);
   while(q--)
   {
   long long int n,k,i,f=0;
   scanf("%lli",&n);
   if(n%2==0)
   {
       printf("%lli %lli\n",n/2,n/2);

   }
   else
   {
       for(i=sqrt(n);i>1;i--)
       {
           if(n%i==0)
           {k=(n/i>i)?n/i:i;
               f=1;
               printf("%lli %lli\n",k,n-k);
               break;
           }}
           if(f==0)
           {
               printf("%d %lli\n",1,n-1);
           }

   }
}
}

#include <stdio.h>
#include <stdlib.h>

int main() {
	int t, n, x, y;
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		if (n % 2 == 0) {
			printf("%d %d\n", n / 2, n / 2);
		}
		else {
			x = n / 2;
			y = n - x;
			if (y % x == 0) {
				x = n / 2;
				y = n - x;
			}
			else {
				x--;
				y++;
			}
			printf("%d %d\n", x, y);
			continue;
		}

	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    for(i=0; i<t; i++)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d ", n/2);
                    printf("\n");
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i-1;
                k=sqrt(n);
                if(i>sqrt(n) && n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d ", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<math.h>

int main()
{
    int t;
    long int n,a,b;
    scanf("%d",&t);
    for( ; t ;t--)
    {
        scanf("%ld",&n);
        if(n%2)
        {
            b=sqrt(n);
            for(a=3;a<=b;a++)
                if(n%a==0)
                    break;
            if(n%a)
                printf("1 %ld\n",n);
            else
                printf("%ld %ld\n",n/a,n-n/a);
        }
        else
            printf("%ld %ld\n",n/2,n/2);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int T;
    scanf("%d",&T);
    while(T>0)
    {
        long long int n , i  ;
        int found=0;
        scanf("%I64d",&n);
        i=2;
        while((i<=sqrt(n)) && (!found))
        {
            if(n%i==0) found=1;
            else i++;
        }
        printf("%I64d %I64d\n",n/i,n-(n/i));

        T--;
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d\n", n/2);
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i-1;
                k=sqrt(n);
                if(j>sqrt(n)&&n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<stdlib.h>
 int gcd( int a, int b)
{
	 int r=1;
	while(r!=0)
	{
		r=b%a;
		b=a;
		a=r;
	}
	return b;
}
main()
{
	  int t,n,*a,i;
	scanf("%d",&t);
	while(t--)
	{   int save=0,min,g=0,p=0;
		a=( int*)calloc(n,sizeof( int));
		scanf("%d",&n);
		min=n+1;
		if(n%2==0)
		{
			printf("%d %d",n/2,n/2);
		}
		else
		{
		for(i=1;i<=n/2;i++)
		{
			g=gcd(i,n-i);
		//	printf("gcd= %d\n ",g);
			 p=i*(n-i);
			a[i]=p/g;
		}
		for(i=1;i<=n/2;i++)
		{
			if(a[i]<min)
			{
				min=a[i];
				save=i;
			}
		}

		//printf("%d  ",a[i]);
		printf("%lld %lld",save,(n-save));

		}
		printf("\n");
	}
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d\n", n/2);
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i;
                k=sqrt(n);
                if(i>sqrt(n) && n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d ", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    for(i=0; i<t; i++)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d ", n/2);
                    printf("\n");
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i;
                k=sqrt(n);
                if(j>sqrt(n))
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d ", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int q;
   scanf("%d",&q);
   while(q--)
   {
   long long int n,i,f=0,k;
   scanf("%lli",&n);
   if(n%2==0)
   {
       printf("%lli %lli\n",n/2,n/2);

   }
   else
   {
       for(i=sqrt(n);i>1;i--)
       {
           if(n%i==0)
           {f=1;
               k=(n/i>i)?n/i:i;
               printf("%lli %lli\n",i,k);
               break;
           }}
           if(f==0)
           {
               printf("%d %lli\n",1,n-1);
           }

   }
}
}

#include<stdio.h>
#include<math.h>
unsigned long long int minlcm(unsigned long long int n );
int main ()
{

unsigned long long int n,t,i,j;
scanf("%llu",&t);
 for(i=1 ;i<=t ;i++)
 {
     scanf("%llu",&n);
     if (n%2==0) printf("%llu %llu\n",n/2 ,n/2);

     else minlcm(n);

 }

}

unsigned long long int minlcm(unsigned long long int n )
{
  unsigned long long int  a,i;
  for(i=2;i<= sqrt(n) ;i++)
  {
     if(n%i==0)
        {
            a=n/i;
            printf("%llu %llu \n",i,n-i );
            return 0;
        }

  }

    printf("%d %llu \n",1, n-1);
    return 0;

}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,i,t;
    scanf("%d",&t);
    while(t--)
    {
    scanf("%d",&n);
    int x1,x2,c=0;
    int limit=sqrt(n)+1;
    for(i=2;i<=limit;i++)
    {
        if(n%i==0)
        {
          x1=n/i;
          x2=x1*(i-1);
          if(x1<=x2)
          {
              if(x2%x1==0)
              {
                  printf("%d %d\n",x1,x2);
                  c++;
                  break;
              }
          }
        }
    }
    if(c==0)
        printf("1 %d\n",n);
    }
    return 0;
}

#include<stdio.h>
int main()
{
    long long t,i,n,k,l;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        l=1;
        for(i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                l=0;
                break;
            }
        }

       if(l==1)
        printf("%d %lld\n",1,n-1);
       else
       {
            if(n%2==0)
            {
                i=n/2;
                k=i;
            }
            else
            {
                i=n/3;
                k=2*i;
            }
        printf("%lld %lld\n",i,k);
       }
    }
    return 0;
}

#include<stdio.h>
main()
{
	  int t,n,*a,i;
	scanf("%d",&t);
	while(t--)
	{   int save=0,min,g=0,p=0;
		//a=( int*)calloc(n,sizeof( int));
		scanf("%d",&n);
		if(n%2==0)
		{
			printf("%d %d",n/2,n/2);
		}
		else
		{
			for(i=(n+1)/2;i<n;i++)
			{
				if(i%(n-i)==0)
				{
					printf("%d %d",n-i,i);
					break;
				}
			}
		}
	}
		printf("\n");
	}

#include <stdio.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a,count=0;
        scanf("%d",&a);
        if(a%2==0)
        {
            printf("%d %d\n",a/2,a/2);
        }
        else
        {
            for(int i=1;i<=a/2;i++)
            {
                if((a-i)/i==2)
                {
                    count++;
                    printf("%d %d\n",i,a-i);
                }
            }
            if(count==0)
            {
            printf("1 %d\n",a-1);
            }
            count=0;
        }
    }

    return 0;
}

#include<stdio.h>
#include<conio.h>
#include<math.h>

int main()
{
    long long i,n,t,p,a,b;
    scanf("%lld",&b);
    for(t=1; t<=b; t++)
    {
        scanf("%lld",&n);
        if(n%2==0)
        {
            printf("%lld %lld\n",n/2,n/2);
        }
        else{
            p=(int)sqrt(n);
            for(i=3;i<=p+1;i=i+2){
                if(n%i==0){
                    a=n/i;
                    printf("%lld %lld\n",a,(n-a));
                    break;
                }
                else if(i==p+1){
                    printf("%lld %lld\n",1,(n-1));
                    break;
                }
            }
        }
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int q;
   scanf("%d",&q);
   while(q--)
   {
   long long int n,i,f=0,k;
   scanf("%lli",&n);
   if(n%2==0)
   {
       printf("%lli %lli\n",n/2,n/2);

   }
   else
   {
       for(i=sqrt(n)+1;i>1;i--)
       {
           if(n%i==0)
           {f=1;
               k=(n/i>i)?n/i:i;
               printf("%lli %lli\n",k,n-k);
               break;
           }}
           if(f==0)
           {
               printf("%d %lli\n",1,n-1);
           }

   }
}
}

#include <stdio.h>
#include <stdlib.h>

int main() {
	long long int t, n, x, y,i;
	scanf("%lld", &t);
	while (t--) {
		scanf("%lld", &n);
		if (n % 2 == 0) {
			printf("%lld %lld\n", n / 2, n / 2);
		}
		else {
			for (i = 2; i * i <= n; i++) {
				if (n % i == 0) {
					printf("%lld %lld", n / i, n*(i-1)/i);
				}
			}
		}

	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d ", n/2);
                    printf("\n");
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i;
                k=sqrt(n);
                if(i>sqrt(n)&&n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d ", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<stdlib.h>
 int gcd(long long int a,long long int b)
{
	long long int r=1;
	while(r!=0)
	{
		r=b%a;
		b=a;
		a=r;
	}
	return b;
}
main()
{
	  int t,n,*a,i;
	scanf("%d",&t);
	while(t--)
	{   int save=0,min,g=0,p=0;
		a=( int*)calloc(n,sizeof( int));
		scanf("%d",&n);
		min=n+1;
		if(n%2==0)
		{
			printf("%d %d",n/2,n/2);
		}
		else
		{
		for(i=1;i<=n/2;i++)
		{
			g=gcd(i,n-i);
		//	printf("gcd= %d\n ",g);
			 p=i*(n-i);
			a[i]=p/g;
		}
		for(i=1;i<=n/2;i++)
		{
			if(a[i]<min)
			{
				min=a[i];
				save=i;
			}
		}

		//printf("%d  ",a[i]);
		printf("%lld %lld",save,(n-save));

		}
		printf("\n");
	}
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d\n", n/2);
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i;
                k=sqrt(n);
                if(i>sqrt(n)&&n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include <stdio.h>
#include <stdlib.h>

int main() {
	int t, n, x, y;
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		if (n % 2 == 0) {
			printf("%d %d\n", n / 2, n / 2);
		}
		else {
			x = n / 2;
			y = n - x;
			if (y % x == 0) {
				x = n / 2;
				y = n - x;
			}
			else {
				x--;
				y++;
			}
			printf("%d %d", x, y);
			continue;
		}

	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int T;
    scanf("%d",&T);
    while(T>0)
    {
        long long int n , i  ;
        int found=0;
        scanf("%I64d",&n);
        i=2;
        while((i<=sqrt(n)) && (!found))
        {
            if(n%i==0) found=1;
            else i++;
        }
        printf("%I64d %I64d\n",n/i,n-(n/i));

        T--;
    }
    return 0;
}

#include<stdio.h>
int main()
{
        long long int t,n,i,j,factor;
        scanf("%lld",&t);
        for(i=0;i<t;i++)
        {
                scanf("%lld",&n);
		for(j=2;j*j<=n;j++)
		{
			if(n%j==0)
			{
				factor=j;
				break;
			}
		}
		printf("%lld %lld\n",(factor-1)*n/factor,n/factor);
        }
}

#include<stdio.h>
#include<math.h>
int is_prime(int n)
{
    int x=sqrt(n);
    int flag=0;
    if(n<2){
        return 0;
    }
    else if(n==2){
        return 1;
    }
    else {
        if(n%2==0){
            return 0;
        }
        else{
            for(int i=3;i<=x+1;i+=2){
                if(n%i==0){
                    return 0;
                    break;
                }
            }
        }
    }
    return 1;
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--){
        int n;
        scanf("%d",&n);
        if(n%2==0){
            printf("%d %d\n",n/2,n/2);
        }
        else if(n%3==0){
            printf("%d %d\n",n/3,(2/3)*n);
        }
        else {
            int prime=is_prime(n);
            if(prime){
                printf("%d %d\n",1,n-1);
            }
            else{
                int x=n/2;
                if(x%2==0){
                    x++;
                }
                for(int i=x;i>=1;i-=2){
                    int m=n-i;
                    if(m%i==0){
                        printf("%d %d\n",i,m);
                        break;
                    }
                }
            }
        }
    }
    return 0;
}

#include<stdio.h>
int prime(int a)
{
int f=0;
for(int i=2;i<=sqrt(a);i++)
{
if(a%i==0)
{
f=1;
break;
}
}
if(f==1) return 0;
else return 1;
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
    int n;
    scanf("%d",&n);
    if(n%2==0)
    printf("%d %d\n",n/2,n/2);
    else
    {
    int check=prime(n);
    if(check==1)
    printf("1 %d\n",n-1);
    else
    printf("%d %d\n",n/3,n-(n/3));
    }
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main() {
	int t, n, x, y;
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		if (n % 2 == 0) {
			printf("%d %d\n", n / 2, n / 2);
		}
		else {
			x = n / 2;
			y = n - x;
			if (y % x == 0) {
				x = n / 2;
				y = n - x;
			}
			else {
				x--;
				y++;
			}
			printf("%d %d\n", x, y);
			continue;
		}

	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    while(t--)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d\n", n/2);
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i-1;
                k=sqrt(n);
                if(i>sqrt(n)&&n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include<stdio.h>
#include<limits.h>
#include<stdlib.h>
/*long long int min(long long int a,long long int b)
{
    if(a>b)
    return b;
    else
    return a;
}
long long int LCM(long long int a,long long int b)
{
    long long int i;
    for(i=b;;i+=b)
    {
        if(i%a==0)
        {
            return i;
        }
    }
}*/
int main()
{
    int t;int i;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        long long int n=0,m=LLONG_MAX,a=0,j;
        scanf("%lld",&n);
        if(n%2==0)
        {
            printf("%lld %lld \n",n/2,n/2);
            continue;
        }
        else
        {
            for(j=2;j*j<=n;j++)
            {
                if(n%j==0)
                {
                    /*long long int y=LCM(j,n-j);
                    m=min(m,y);
                    if(m==y)
                    {
                        a=j;
                    }*/
                    printf("%lld %lld \n",n/j,n-(n/j));
                    break;
                }
            }

        }
    }
}

#include <stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
//float pi=acos(-1.0);
//int dp[1000000001];
//char str[2000000009];
int main()
{
    int i,j,m,n,t,k;
    scanf("%d", &t);
    for(i=0;i<t;i++){
        scanf("%d", &n);
        if(n%2==0)printf("%d %d\n", n/2, n/2);
        else{
            for(j=n/2;j<n;j++){
                if(j%(n-j)==0){
                    break;
                }
            }
            printf("%d %d", (n-j),j);
        }
    }
    return 0;
}

#include<stdio.h>
int main()
{
        long long int t,n,i,j,factor;
        scanf("%lld",&t);
        for(i=0;i<t;i++)
        {
                scanf("%lld",&n);
		factor=n;
		for(j=2;j*j<=n;j++)
		{

			if(n%j==0)
			{
				factor=j;
				break;
			}
		}
		printf("%lld\n",factor);
	 printf("%lld %lld\n",(factor-1)*n/factor,n/factor);

        }
}

#include<stdio.h>
#include<math.h>
int main()
{
    int i,t,j,n,k;
    scanf("%d", &t);
    for(i=0; i<t; i++)
        {
            scanf("%d", &n);
            if(n%2==0)
                {
                    printf("%d ", n/2);
                    printf("%d ", n/2);
                    printf("\n");
                }
            else{

            for(i=3; i<=sqrt(n); i++);
                {
                    if(n%i==0)
                    {
                        break;
                    }

                }
                j=i;
                k=sqrt(n);
                if(j>sqrt(n) && n%k!=0)
                {
                    printf("1 ");
                    printf("%d", n-1);
                    printf("\n");
                }
                else
                {
                    printf("%d ", n/j);
                    printf("%d ", n-n/j);
                    printf("\n");
                }
            }
        }
}

#include <stdio.h>
#include<string.h>
#include<math.h>

void joss_joss()
{
    int ara[20]={3,5,7,9,11,13,15,17,19};
    long long int n,i;
    scanf("%lld",&n);
   if(n%2==0)
    printf("%lld %lld\n",n/2,n/2);
   else
   {
       for(i=0;i<9;i++)
       {if(n%ara[i]==0)
           {
               printf("%lld %lld\n",n/ara[i],n-n/ara[i]);
               return 0;
           }
       }
        printf("1 %lld\n",n-1);
   }

}

int main()
{
    int t ;
    scanf("%d",&t);
    while(t--)
       joss_joss();
}

#include <stdio.h>

#define max(x,y) x > y ? x : y

int main() {
    long long int i,t,n,x;
    scanf("%lld",&t);
    while(t--){
        scanf("%lld",&n);
        if(n % 2 == 0){
            printf("%lld %lld\n",n /2,n / 2);
            continue;
        }
        else{
            for(i = sqrt(n) + 1; i >= 1; i--){
                if(n % i == 0){
                    x = max(n / i,i);
                    break;
                }
            }
            printf("%lld %lld\n",x,n - x);
        }
    }
}

#include<stdio.h>

int main()
{
    int t,x,i,p,q,j;

    scanf("%d",&t);

    while(t--)
    {
        scanf("%d",&x);

        if(x%2==0)
        {
            printf("%d %d\n",x/2,x/2);

            continue;
        }

        for(i=1;i*i<=x;i++)
        {
            if(x%i==0)
            {
                p=i; q=x-i;
            }
        }

        printf("%d %d\n",p,q);
    }
}

#include<stdio.h>

int prime(int num){
	for(int i = 2; i <= num/2; i++){
		if(num%i == 0)
			return 0;
	}
	return 1;
}

int main(int arg, char* argv){
	int cases;
	int num;
	scanf("%d", &cases);

	while(cases--){
		scanf("%d", &num);
		if(num%2 == 0){
			printf("%d %d\n", num/2, num/2);
		}
		else if(prime(num)){
			printf("%d %d\n", 1, num-1);
		}
		else{
			printf("%d %d\n", num/3, (2*num)/3);
		}
	}

	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main() {
	int t, n, x, y;
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		if (n % 2 == 0) {
			printf("%d %d\n", n / 2, n / 2);
		}
		else {
			x = n / 2;
			y = n - x;
			if (y % x == 0) {
				x = n / 2;
				y = n - x;
			}
			else {
				x--;
				y++;
			}
			printf("%d %d", x, y);
			continue;
		}

	}
	return 0;
}

#include<stdio.h>

int main()
{
    long long int t, n, i, r;
    scanf("%lld", &t);
    while(t--)
    {
        scanf("%lld", &n);
        if(n%2==0)
            printf("%lld %lld\n", n/2, n/2);
        else
        {
            r=sqrt(n);
            for(i=r;i>=1;i--)
            {
                if(n%i==0)
                {
                    printf("%lld %lld\n", i, n-i);
                    break;
                }
            }
        }

    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    long long t,i,n,k,l;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        l=sqrt(n);
        for(i=l;i>=1;i--)
        {
            if(n%i==0)
            {
                if(i!=1) i=n/i;
                printf("%lld %lld\n",i,n-i);
                break;
            }
        }

    }
    return 0;
}

#include <stdio.h>
int n, t, min;

int gcd(int a, int b)
{
    if (a == b) return a;
    else
    {
        if (a > b) return gcd(a - b, b);
        else return gcd(b - a, a);
    }
}

int lcm (int a, int b)
{
    return (a * b) / gcd(a, b);
}

int testcase(int n)
{
    min = lcm(1, n);
    for (int i = 1; i <= n / 2; i++)
        if (lcm(i, n - i) < min) min = lcm(i, n - i);
    for (int i = 1; i <= n / 2; i++)
        if (min == lcm(i, n - i)) return i;
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &t);
        printf("%d %d", testcase(t), t - testcase(t));
    }

    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int t;
    scanf("%d",&t);
    int i;
    for(i=0;i<t;i++)
    {
      int n,m,j,u=0;
      scanf("%d",&n);
      if(n%2==0)
      {
          printf("%d %d\n",n/2,n/2);
          continue;
      }
      j=3;
      while(j<=sqrt(n))
      {
          if(n%j==0)
          {
              u++;
            break;
          }
          j++;
      }
      if(u==0)
        printf("1 %d\n",(n-1));
      if(u==1)
        printf("%d %d\n",n/j,((j-1)*n)/j);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int T;
    scanf("%d",&T);
    while(T>0)
    {
        long long int n , i  ;
        int found=0;
        scanf("%I64d",&n);
        i=2;
        while((i<=sqrt(n)) && (!found))
        {
            if(n%i==0) found=1;
            else i++;
        }
        printf("%I64d %I64d\n",n/i,n-(n/i));

        T--;
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
void main()
{
 int t;
 scanf("%d",&t);
 while(t--)
{
long int n,s;
scanf("%ld",&n);
if((n%2)==0)
    printf("%ld %ld\n",n/2,n/2);
else
 {
  s=1;
  for(int i=2;i<=sqrt(n);i++)
  {
    if((n%i)==0)
    {
      s=(n/i);
    }
  }
  printf("%ld %ld\n",s,n-s);
 }
}
}

#include<stdio.h>
#include<math.h>
main()
{
	  int t,n,*a,i;
	scanf("%d",&t);
	while(t--)
	{   int save=0,min,g=0,p=0;
		//a=( int*)calloc(n,sizeof( int));
		scanf("%d",&n);
		if(n%2==0)
		{
			printf("%d %d",n/2,n/2);
		}
		else
		{
			for(i=sqrt(n);i=1;i--)
			{
				if((n-i)%i==0)
				{
					printf("%d %d",i,n-i);
					break;
				}
			}
		}
			printf("\n");
	}

	}