description: Gregor is learning about RSA cryptography, and although he doesn't understand how RSA works, he is now fascinated with prime numbers and factoring them.
  
  Gregor's favorite prime number is P. Gregor wants to find two bases of P. Formally, Gregor is looking for two integers a and b which satisfy both of the following properties.
  
    * P mod a = P mod b, where x mod y denotes the remainder when x is divided by y, and 
    * 2 ≤ a < b ≤ P. 
  
  
  
  Help Gregor find two bases of his favorite prime number!
  
  Input
  
  Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000).
  
  Each subsequent line contains the integer P (5 ≤ P ≤ {10}^9), with P guaranteed to be prime.
  
  Output
  
  Your output should consist of t lines. Each line should consist of two integers a and b (2 ≤ a < b ≤ P). If there are multiple possible solutions, print any.
  
  Example
  
  Input
  
  
  2
  17
  5
  
  
  Output
  
  
  3 5
  2 4
  
  Note
  
  The first query is P=17. a=3 and b=5 are valid bases in this case, because 17 mod 3 = 17 mod 5 = 2. There are other pairs which work as well.
  
  In the second query, with P=5, the only solution is a=2 and b=4.
solution: import static java.lang.Math.max;
  import static java.lang.Math.min;
  import static java.lang.Math.abs;
  import static java.lang.System.out;
  import java.util.* ;
  import java.math.*;
  import java.io.*;
  
  
   public class javaTemplate {
  	
  	public static final int M = 1000000007 ;
  	static FastReader sc = new FastReader();
  	static int N = 86028121 ;
  	static boolean globB[] = new boolean[N+1] ;
  	static int globA[] = new int[10000000] ;
  	
  	
  	public static void main(String[] args) {
  		
  int t = sc.nextInt() ;
  		
  		while(t -- != 0) {
  			int p = sc.nextInt() ;
  			System.out.println("2" + " " + (p-1));
  		}
  		
  	}
  
  
  	/*
  	 @ Observation is imp. for problem A and B
  	 1->> Read the problem properly take time to read the problem 
  	 if it is too lengthy.
  	 2->> Draw the test cases of A and B 
  	 3->> Don't over think the problem 
  	 4->> Try to take sum variable as long
  	 5->> Avoid Nested if else statement
  	 6->> If it looks like a Greedy problem try to figure out the ans. 
  	 for the smallest test case.
  	 7->> If it is a binary String check no. of 0's and 1's. 
  	 If it is a even try to pair it (may be not applicable for every questions).
  	 8->> Always check the constrains and try BruteForce
  	 @ Implement it quickly 
  	 */
  	
  
  	
  	
  	
  
  
  	
  	
  //_________________________//Template//_____________________________________________________________________
  	
  	
  		//		FAST I/O
  		static class FastReader {
  	        BufferedReader br;
  	        StringTokenizer st;
  	        
  	        public FastReader()
  	        {
  	            br = new BufferedReader(
  	                new InputStreamReader(System.in));
  	        }
  	 
  	        String next()
  	        {
  	            while (st == null || !st.hasMoreElements()) {
  	                try {
  	                    st = new StringTokenizer(br.readLine());
  	                }
  	                catch (IOException e) {
  	                    e.printStackTrace();
  	                }
  	            }
  	            return st.nextToken();
  	        }
  	 
  	        int nextInt() { return Integer.parseInt(next()); }
  	 
  	        long nextLong() { return Long.parseLong(next()); }
  	 
  	        double nextDouble()
  	        {
  	            return Double.parseDouble(next());
  	        }
  	 
  	        String nextLine()
  	        {
  	            String str = "";
  	            try {
  	                str = br.readLine();
  	            }
  	            catch (IOException e) {
  	                e.printStackTrace();
  	            }
  	            return str;
  	        }
  		}
  	
  	
  		
  		
  		
  		// Sorting
  		public static void sort(int[] arr) {
  	        //because Arrays.sort() uses quicksort which is dumb
  	        //Collections.sort() uses merge sort
  	        ArrayList<Integer> ls = new ArrayList<Integer>();
  	        for(int x: arr)
  	            ls.add(x);
  	        Collections.sort(ls);
  	        for(int i=0; i < arr.length; i++)
  	            arr[i] = ls.get(i);
  	    }
  		
  		
  		
  		
  		
  		// Modulo
  		static int mod(int a) {
  		   return (a%M + M) % M;
  		}
  		
  		
  		
  		
  		
  		
  		
  		//		Palindrom or Not
  		static boolean isPalindrome(String str, int low, int high) {
  					while (low < high) {
  						if (str.charAt(low) != str.charAt(high)) return false;
  					 	low++;
  					 	high--;
  					}
  					return true;
  				}
  	
  	
  
  	
  	
  	
  	
  	
  	
  	
  	
  		// check if sorted or not	
  		public static boolean isSorted(int[] a)
  	    {
  	        for (int i = 0; i < a.length - 1; i++)
  	        {
  	            if (a[i] > a[i + 1]) {
  	                return false;
  	            }
  	        }
  	        return true;
  	    }
  	
  	
  	
  		
  		
  	
  		// GCD
  		public static int GCD(int a , int b) {
  				if(b == 0) return a ;
  				
  				return GCD(b, a%b) ;
  			}
  	
  		
  		
  		
  		
  		// sieve
  		public static void sieve() {
  			Arrays.fill(globB, true);
  			globB[0] = false ;
  			globB[1] = false ;
  			for(int i = 2 ; i * i <= N ; i++) {
  				if(globB[i]) {
  				for(int j = i * i ; j<= N ; j+= i) {
  					globB[j] = false ;
  				 }
  				}
  			}
  			
  		}
  
  		
  		
  		
  		// fastPower
  		public static long fastPowerModulo(long a, long b, long n) {
  			long res = 1 ;
  			while(b > 0) {
  			if((b&1) != 0) {
  				res = (res * a % n) % n ;
  			}
  			a = (a % n * a % n) % n ;
  			b = b >> 1 ;
  			}
  			return res ;
  		}
  	
  		
  		
          // LCM
  		static int LCM(int a, int b)
  	    {
  	        return (a / GCD(a, b)) * b;
  	    }
  		
  
  }
  
  
   
   
   
   
   
   
  