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.util.*;
  public class cp
  {
  	static class Reader {
  		final private int BUFFER_SIZE = 1 << 16;
  		private DataInputStream din;
  		private byte[] buffer;
  		private int bufferPointer, bytesRead;
  
  		public Reader()
  		{
  			din = new DataInputStream(System.in);
  			buffer = new byte[BUFFER_SIZE];
  			bufferPointer = bytesRead = 0;
  		}
  
  		public Reader(String file_name) throws IOException
  		{
  			din = new DataInputStream(
  					new FileInputStream(file_name));
  			buffer = new byte[BUFFER_SIZE];
  			bufferPointer = bytesRead = 0;
  		}
  
  		public String readLine() throws IOException
  		{
  			byte[] buf = new byte[64]; // line length
  			int cnt = 0, c;
  			while ((c = read()) != -1) {
  				if (c == '\n') {
  					if (cnt != 0) {
  						break;
  					}
  					else {
  						continue;
  					}
  				}
  				buf[cnt++] = (byte)c;
  			}
  			return new String(buf, 0, cnt);
  		}
  
  		public int nextInt() throws IOException
  		{
  			int ret = 0;
  			byte c = read();
  			while (c <= ' ') {
  				c = read();
  			}
  			boolean neg = (c == '-');
  			if (neg)
  				c = read();
  			do {
  				ret = ret * 10 + c - '0';
  			} while ((c = read()) >= '0' && c <= '9');
  
  			if (neg)
  				return -ret;
  			return ret;
  		}
  
  		public long nextLong() throws IOException
  		{
  			long ret = 0;
  			byte c = read();
  			while (c <= ' ')
  				c = read();
  			boolean neg = (c == '-');
  			if (neg)
  				c = read();
  			do {
  				ret = ret * 10 + c - '0';
  			} while ((c = read()) >= '0' && c <= '9');
  			if (neg)
  				return -ret;
  			return ret;
  		}
  
  		public double nextDouble() throws IOException
  		{
  			double ret = 0, div = 1;
  			byte c = read();
  			while (c <= ' ')
  				c = read();
  			boolean neg = (c == '-');
  			if (neg)
  				c = read();
  
  			do {
  				ret = ret * 10 + c - '0';
  			} while ((c = read()) >= '0' && c <= '9');
  
  			if (c == '.') {
  				while ((c = read()) >= '0' && c <= '9') {
  					ret += (c - '0') / (div *= 10);
  				}
  			}
  
  			if (neg)
  				return -ret;
  			return ret;
  		}
  
  		private void fillBuffer() throws IOException
  		{
  			bytesRead = din.read(buffer, bufferPointer = 0,
  					BUFFER_SIZE);
  			if (bytesRead == -1)
  				buffer[0] = -1;
  		}
  
  		private byte read() throws IOException
  		{
  			if (bufferPointer == bytesRead)
  				fillBuffer();
  			return buffer[bufferPointer++];
  		}
  
  		public void close() throws IOException
  		{
  			if (din == null)
  				return;
  			din.close();
  		}
  	}
  
  	public static void main(String[] args) throws IOException
  	{
  		try{
  			//Your Solve
  			Reader s = new Reader();
  			//			Scanner s = new Scanner(System.in);
  			int t = s.nextInt();
  			for(int p = 0;p < t;p++){
  				int n = s.nextInt();
  				System.out.println(2 + " " + (n-1));
  				
  				
  			}
  
  		}catch(Exception e){
  			return;
  		}
  	}
  }