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