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 Main {
  
      static int M = 1_000_000_007;
      static int INF = 2_000_000_000;
      static int N = (int)1e5+1;
      static final FastScanner fs = new FastScanner();
  
      //variable
  
      public static void main(String[] args) throws IOException {
  
          int T = fs.nextInt();
          while(T-- > 0) {
              int n = fs.nextInt();
              if(n%2 == 0) System.out.println(2+" "+n);
              else System.out.println(2+" "+(n-1));
  //            char[] s1 = fs.next().toCharArray();
  //            char[] s2 = fs.next().toCharArray();
  //
  //            for(int i=0;i<n;i++){
  //
  //            }
          }
  
  
      }
      //class
  
      //function
  
      // Template
  
      static long lcm(long a, long b) {
          return (a / gcd(a, b)) * b;
      }
  
      static long gcd(long a, long b) {
          if(a==0) return b;
  
          return gcd(b%a,a);
      }
      static void premutation(int n, ArrayList<Integer> arr,boolean[] chosen) {
          if(arr.size() == n) {
              System.out.println(arr);
          }else {
              for(int i=1; i<=n; i++) {
                  if(chosen[i]) continue;
                  arr.add(i);
                  chosen[i] = true;
                  premutation(n,arr,chosen);
                  arr.remove(new Integer(i));
                  chosen[i] = false;
              }
          }
      }
      static boolean isPalindrome(char[] c) {
          int n = c.length;
          for(int i=0; i<n/2; i++) {
              if(c[i] != c[n-i-1]) return false;
          }
          return true;
      }
  
      static long nCk(int n, int k) {
          return (modMult(fact(n),fastexp(modMult(fact(n-k),fact(k)),M-2)));
      }
  
      static long fact (long n) {
  
          long fact =1;
          for(int i=1; i<=n; i++) {
              fact = modMult(fact,i);
          }
          return fact%M;
      }
  
      static int modMult(long a,long b) {
          return (int) (a*b%M);
      }
      static int negMult(long a,long b) {
          return (int)((a*b)%M + M)%M;
      }
      static long fastexp(long x, int y){
          if(y==1) return x;
  
          long ans = fastexp(x,y/2);
          if(y%2 == 0) return modMult(ans,ans);
          else return modMult(ans,modMult(ans,x));
      }
  
      static final Random random = new Random();
  
      static void ruffleSort(int[] arr)
      {
          int n = arr.length;
          for(int i=0; i<n; i++)
          {
              int j = random.nextInt(n);
              int temp = arr[j];
              arr[j] = arr[i];
              arr[i] = temp;
          }
          Arrays.sort(arr);
      }
  
  
      public static class Pairs implements Comparable<Pairs>
      {
          int f,s;
          Pairs(int f, int s)
          {
              this.f = f;
              this.s = s;
          }
          public int compareTo(Pairs p)
          {
              return Integer.compare(this.f,p.f);
          }
  
          @Override
          public boolean equals(Object o) {
              if (this == o) return true;
              if (!(o instanceof Pairs)) return false;
              Pairs pairs = (Pairs) o;
              return f == pairs.f && s == pairs.s;
          }
  
          @Override
          public int hashCode() {
              return Objects.hash(f, s);
          }
      }
  }
  class FastScanner
  {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer str = new StringTokenizer("");
  
      String next() throws IOException
      {
          while(!str.hasMoreTokens())
              str = new StringTokenizer(br.readLine());
  
          return str.nextToken();
      }
  
      char nextChar() throws IOException {
          return next().charAt(0);
      }
  
      int nextInt() throws IOException
      {
          return Integer.parseInt(next());
      }
  
      float nextFloat() throws IOException
      {
          return Float.parseFloat(next());
      }
  
      double nextDouble() throws IOException
      {
          return Double.parseDouble(next());
      }
      long nextLong() throws IOException
      {
          return Long.parseLong(next());
      }
      byte nextByte() throws IOException
      {
          return Byte.parseByte(next());
      }
      int [] arrayIn(int n) throws IOException
      {
          int[] arr = new int[n];
          for(int i=0; i<n; i++)
          {
              arr[i] = nextInt();
          }
          return arr;
      }
  }