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.*;
  import java.math.BigInteger;
  import java.util.*;
  import java.util.concurrent.TimeUnit;
  
  public class a1549 implements Runnable{
  	
      public static void main(String[] args) {
      	try{
              new Thread(null, new a1549(), "process", 1<<26).start();
          }
          catch(Exception e){
              System.out.println(e);
          }
      }
  	public void run() {
  		FastReader scan = new FastReader();
          PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
  		//PrintWriter out = new PrintWriter("file.out");
  		Task solver = new Task();
  		int t = scan.nextInt();
  		//int t = 1;
  		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
  		out.close();
  	}
  
  	static class Task {
  		static final int oo = Integer.MAX_VALUE;
  		static final long OO = Long.MAX_VALUE;
  
  		public void solve(int testNumber, FastReader sc, PrintWriter out) {
  			int P = sc.nextInt();
  			
  			if(P % 2 == 0) {
  				out.println("2 " + P);
  			} else {
  				out.println("2 " + (P-1));
  			}
  		}
  		
  	}
  	static long modInverse(long N, long MOD) {
  		return binpow(N, MOD - 2, MOD);
  	}
  	static long modDivide(long a, long b, long MOD) {
  		a %= MOD;
  		return (binpow(b, MOD-2, MOD) * a) % MOD;
  	}
  	static long binpow(long a, long b, long m) {
  		a %= m;
  		long res = 1;
  		while (b > 0) {
  			if ((b & 1) == 1)
  				res = res * a % m;
  			a = a * a % m;
  			b >>= 1;
  		}
  		return res;
  	}
  	static int[] reverse(int a[]) 
      { 
          int[] b = new int[a.length]; 
          for (int i = 0, j = a.length; i < a.length; i++, j--) { 
              b[j - 1] = a[i]; 
          } 
          
          return b;
      }
  	static long[] reverse(long a[]) 
      { 
          long[] b = new long[a.length]; 
          for (int i = 0, j = a.length; i < a.length; i++, j--) { 
              b[j - 1] = a[i]; 
          } 
          
          return b;
      }
  	
  	static void shuffle(Object[] a) {
  		Random get = new Random();
  		for (int i = 0; i < a.length; i++) {
  			int r = get.nextInt(a.length);
  			Object temp = a[i];
  			a[i] = a[r];
  			a[r] = temp;
  		}
  	}
  	
  	static void shuffle(int[] a) {
  		Random get = new Random();
  		for (int i = 0; i < a.length; i++) {
  			int r = get.nextInt(a.length);
  			int temp = a[i];
  			a[i] = a[r];
  			a[r] = temp;
  		}
  	}
  	static void shuffle(long[] a) {
  		Random get = new Random();
  		for (int i = 0; i < a.length; i++) {
  			int r = get.nextInt(a.length);
  			long temp = a[i];
  			a[i] = a[r];
  			a[r] = temp;
  		}
  	}
  	
  	static class tup implements Comparable<tup>, Comparator<tup>{
  		int a, b;
  		tup(int a,int b){
  			this.a=a;
  			this.b=b;
  		}
  		public tup() {
  		}
  		@Override
  		public int compareTo(tup o){
  			return Integer.compare(b,o.b);
  		}
  		@Override
  		public int compare(tup o1, tup o2) {
  			return Integer.compare(o1.b, o2.b);
  		}
  		
  		@Override
  	    public int hashCode() {
  			return Objects.hash(a, b);
  	    }
   
  	    @Override
  	    public boolean equals(Object obj) {
  	    	if (this == obj)
                  return true;
  	    	if (obj == null)
                  return false;
  	    	if (getClass() != obj.getClass())
                  return false;
  	    	tup other = (tup) obj;
  	    	return a==other.a && b==other.b;
  	    }
  	    
  	    @Override
  	    public String toString() {
  	    	return a + " " + b;
  	    }
  	}
  
  	static class FastReader {
  		BufferedReader br;
  		StringTokenizer st;
  
  		public FastReader() {
  			br = new BufferedReader(new InputStreamReader(System.in));
  		}
  
  		public FastReader(String s) throws FileNotFoundException {
  			br = new BufferedReader(new FileReader(new File(s)));
  		}
  
  		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;
  		}
  		
  		int[] readArray(int size) {
  			int[] a = new int[size];
  			for(int i = 0; i < size; i++) {
  				a[i] = nextInt();
  			}
  			return a;
  		}
  		
  		long[] readLongArray(int size) {
  			long[] a = new long[size];
  			for(int i = 0; i < size; i++) {
  				a[i] = nextLong();
  			}
  			return a;
  		}
  	}
  	
  	static void dbg(int[] arr) {
  		System.out.println(Arrays.toString(arr));
  	}
  	static void dbg(long[] arr) {
  		System.out.println(Arrays.toString(arr));
  	}
  	static void dbg(boolean[] arr) {
  		System.out.println(Arrays.toString(arr));
  	}
  
  	static void dbg(Object... args) {
          for (Object arg : args)
              System.out.print(arg + " ");
          System.out.println();
      }
  }