fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4.  
  5. int32_t main() {
  6. ios::sync_with_stdio(false);
  7. cin.tie(NULL);
  8.  
  9. int t;
  10. cin>>t;
  11. while(t--){
  12. int n;
  13. cin>>n;
  14. if(n%2==0) cout<<n/2<<" "<<n/2<<endl;
  15. else {
  16. int p=0;
  17. for(int i=3;i*i<=n;i+=2){
  18. if(n%i==0) {
  19. p=i;
  20. break;
  21. }
  22. }
  23. if(p==0) cout<<1<<" "<<n-1<<endl;
  24. else cout<<n/p<<" "<<n-n/p<<endl;
  25. }
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5320KB
stdin
3
4
6
9
stdout
2 2
3 3
3 6