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 java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStream;
  import java.io.PrintWriter;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Comparator;
  import java.util.HashMap;
  import java.util.StringTokenizer;
  
  public class Run {
  	
  	static class FastReader{
          BufferedReader br; StringTokenizer st;
          public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } 
          int nextInt() { return Integer.parseInt(next()); } 
          long nextLong() { return Long.parseLong(next()); } 
          double nextDouble() { return Double.parseDouble(next()); } 
          String next() { 
              while (st == null || !st.hasMoreElements()) { 
                  try{ st = new StringTokenizer(br.readLine()); } 
                  catch (IOException  e) { e.printStackTrace(); } 
              } return st.nextToken(); } 
          String nextLine() { 
              String str = ""; 
              try { str = br.readLine(); } 
              catch (IOException e) { e.printStackTrace(); } 
              return str; } 
      }
  	
  	static int[] inputArray(FastReader in, int n) {
      	int arr[] = new int[n];
      	for(int i=0; i<n; i++)
      		arr[i] = in.nextInt();
      	return arr;
      }
  	
  	static int findTheArray(int s) {
  		if(s == 1) return 1;
  		int n = 0, sum = 0;
  		while(sum < s) {
  			sum += (2*n+1); 
  			n++;
  		}
  		return n;
  	}
  	
  	static int maxPoints(int n, int a, int b, String s) {
  		if(b >= 0) return n*(a+b);
  		int oneString = 0, zeroString = 0;
  		for(int i=0; i<s.length(); i++) {
  			if(s.charAt(i) == '1' && (i==0 || s.charAt(i-1) == '0'))
  				oneString++;
  			else if(s.charAt(i) == '0' && (i==0 || s.charAt(i-1) == '1'))
  					zeroString++;
  		}
  		return n*a + (Math.min(oneString, zeroString) + 1) * b;
  	}
  	
  	static int[] paints(int n, int k, int arr[]) {
  		HashMap<Integer, Integer> set = new HashMap<>();
  		for(int i: arr)
  			set.put(i, set.getOrDefault(i, 0)+1);
  		ArrayList<int[]> counts = new ArrayList<>();
  		for(int i: set.keySet())
  			counts.add(new int[] {i, set.get(i)});
  		counts.sort(new Comparator<int[]>() {
  			@Override
  			public int compare(final int[] entry1, final int[] entry2) {
  				return entry1[1] < entry2[1] ? 1 : -1;
  			}
  		});
  		HashMap<Integer, ArrayList<Integer>> assignments = new HashMap<>();
  		boolean stop = false;
  		for(int i=0, j=1; i<counts.size() && !stop; i++) {
  			int c[] = counts.get(i);
  			ArrayList<Integer> colours = new ArrayList<>();
  			n -= c[1];
  			c[1] = Math.min(c[1], k);
  			while(c[1] > 0) {
  				colours.add(j);
  				if(j == k && n+c[1]-1 >= k)
  					j = 1;
  				else if(j== k) {
  					stop = true;
  					break;
  				}
  				else
  					j++;
  				c[1] --;
  			}
  			assignments.put(c[0], colours);
  		}
  		int out[] = new int[arr.length];
  		for(int i=0; i<arr.length; i++) {
  			if(!assignments.containsKey(arr[i]) || assignments.get(arr[i]).size() == 0) ;
  			else 
  				out[i] = assignments.get(arr[i]).remove(0);
  		}
  		return out;
  	}
  	
  	public static void main (String[] args) throws java.lang.Exception {
  		try{
  		    OutputStream outputStream = System.out;
              PrintWriter out = new PrintWriter(outputStream);
              FastReader in = new FastReader();
              int testcase = in.nextInt();
              while(testcase-- >0){
              	int n = in.nextInt();
              	HashMap<Integer, Integer> reminders = new HashMap<>();
              	for(int i=2; i<=n; i++) {
              		int r = n%i;
              		if(reminders.containsKey(r)) {
              			out.println(reminders.get(r) + " " + i);
              			break;
              		}
              		reminders.put(r, i);
              	}
              	//int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();
              	//out.println(((n-(k%n))%2 == 0 ? "YES" : "NO"));
      		}
              out.close();
  		}catch(Exception e){
  			return;
  		}
  	}
  
  }
  