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.OutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.PrintWriter;
  import java.util.List;
  import java.util.HashMap;
  import java.util.InputMismatchException;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.io.InputStream;
  
  /**
   * Built using CHelper plug-in
   * Actual solution is at the top
   *
   * @author Sandip Jana
   */
  public class Main {
  	public static void main(String[] args) {
  		InputStream inputStream = System.in;
  		OutputStream outputStream = System.out;
  		InputReader in = new InputReader(inputStream);
  		PrintWriter out = new PrintWriter(outputStream);
  		TaskA solver = new TaskA();
  		int testCount = Integer.parseInt(in.next());
  		for (int i = 1; i <= testCount; i++)
  			solver.solve(i, in, out);
  		out.close();
  	}
  
  	static class TaskA {
  		public void solve(int testNumber, InputReader in, PrintWriter out) {
  			int prime = in.readInt();
  			HashMap<Integer, List<Integer>> hm = new HashMap<>();
  			for (int i = 2, j = prime; i <= prime && j >= 2; i++, j--) {
  				int rem1 = prime % i;
  				int rem2 = prime % j;
  
  				if (!hm.containsKey(rem1)) {
  					hm.put(rem1, new ArrayList<Integer>());
  				}
  				if (!hm.containsKey(rem2)) {
  					hm.put(rem2, new ArrayList<Integer>());
  				}
  
  				hm.get(rem1).add(i);
  				hm.get(rem2).add(j);
  
  				if (hm.get(rem1).size() >= 2) {
  					out.println(hm.get(rem1).get(0) + " " + hm.get(rem1).get(1));
  					return;
  				}
  
  				if (hm.get(rem2).size() >= 2) {
  					out.println(hm.get(rem2).get(0) + " " + hm.get(rem2).get(1));
  					return;
  				}
  			}
  		}
  
  	}
  
  	static class InputReader {
  		private InputStream stream;
  		private byte[] buf = new byte[ 1024 ];
  		private int curChar;
  		private int numChars;
  		private InputReader.SpaceCharFilter filter;
  
  		public InputReader(InputStream stream) {
  			this.stream = stream;
  		}
  
  		public int read() {
  			if (numChars == -1) {
  				throw new InputMismatchException();
  			}
  			if (curChar >= numChars) {
  				curChar = 0;
  				try {
  					numChars = stream.read(buf);
  				} catch (IOException e) {
  					throw new InputMismatchException();
  				}
  				if (numChars <= 0) {
  					return -1;
  				}
  			}
  			return buf[ curChar++ ];
  		}
  
  		public int readInt() {
  			int c = read();
  			while (isSpaceChar(c)) {
  				c = read();
  			}
  			int sgn = 1;
  			if (c == '-') {
  				sgn = -1;
  				c = read();
  			}
  			int res = 0;
  			do {
  				if (c < '0' || c > '9') {
  					throw new InputMismatchException();
  				}
  				res *= 10;
  				res += c - '0';
  				c = read();
  			} while (!isSpaceChar(c));
  			return res * sgn;
  		}
  
  		public String readString() {
  			int c = read();
  			while (isSpaceChar(c)) {
  				c = read();
  			}
  			StringBuilder res = new StringBuilder();
  			do {
  				if (Character.isValidCodePoint(c)) {
  					res.appendCodePoint(c);
  				}
  				c = read();
  			} while (!isSpaceChar(c));
  			return res.toString();
  		}
  
  		public boolean isSpaceChar(int c) {
  			if (filter != null) {
  				return filter.isSpaceChar(c);
  			}
  			return isWhitespace(c);
  		}
  
  		public static boolean isWhitespace(int c) {
  			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
  		}
  
  		public String next() {
  			return readString();
  		}
  
  		public interface SpaceCharFilter {
  			public boolean isSpaceChar(int ch);
  
  		}
  
  	}
  }
  
  