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.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.util.InputMismatchException;
  
  /**
   * @author ethan55
   */
  public class Solution {
  
    public static void main(String[] args) {
      TestRunner.run();
    }
  
    public static class TestCase {
  
      static final boolean MULTIPLE = true;
  
      public void solve(InputReader in, OutputWriter out) {
        int p = in.nextInt();
        p--;
        out.println((p / 2) + " " + p);
      }
    }
  
    public static class TestRunner {
  
      public static void run() {
        InputReader in = new InputReader(System.in);
        try (OutputWriter out = new OutputWriter(System.out)) {
          int testCases = TestCase.MULTIPLE ? in.nextInt() : 1;
          for (int i = 1; i <= testCases; i++) {
            new TestCase().solve(in, out);
          }
        }
      }
  
    }
  
    public static class InputReader {
  
      private final InputStream inputStream;
      private final byte[] inputBuffer = new byte[1024];
      private int bytesRead = 0;
      private int inputBufferIndex = 0;
  
      public InputReader(InputStream inputStream) {
        this.inputStream = inputStream;
      }
  
      private int readByte() {
        if (bytesRead == -1) {
          throw new InputMismatchException();
        }
        if (inputBufferIndex >= bytesRead) {
          inputBufferIndex = 0;
          try {
            bytesRead = inputStream.read(inputBuffer);
          } catch (IOException e) {
            throw new InputMismatchException();
          }
          if (bytesRead <= 0) {
            return -1;
          }
        }
        return inputBuffer[inputBufferIndex++];
      }
  
      public int nextInt() {
        return (int) nextLong();
      }
  
      public long nextLong() {
        long num = 0;
        int b;
        boolean minus = false;
        do {
          b = readByte();
        } while (b != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if (b == '-') {
          minus = true;
          b = readByte();
        }
  
        while (true) {
          if (b >= '0' && b <= '9') {
            num = num * 10 + (b - '0');
          } else {
            return minus ? -num : num;
          }
          b = readByte();
        }
      }
  
    }
  
    public static class OutputWriter implements AutoCloseable {
  
      private static final int BUFFER_SIZE = 1 << 13;
      private final byte[] outputBuffer = new byte[BUFFER_SIZE];
      private final OutputStream outputStream;
      private int outputBufferIndex = 0;
  
      public OutputWriter(OutputStream os) {
        this.outputStream = os;
      }
  
      public OutputWriter println(String s) {
        return writeln(s);
      }
  
      public void flush() {
        innerFlush();
        try {
          outputStream.flush();
        } catch (IOException e) {
          throw new IllegalStateException("Failed to flush");
        }
      }
  
      private OutputWriter write(byte b) {
        outputBuffer[outputBufferIndex++] = b;
        if (outputBufferIndex == BUFFER_SIZE) {
          innerFlush();
        }
        return this;
      }
  
      private OutputWriter write(String s) {
        s.chars()
            .forEach(
                c -> {
                  outputBuffer[outputBufferIndex++] = (byte) c;
                  if (outputBufferIndex == BUFFER_SIZE) {
                    innerFlush();
                  }
                });
        return this;
      }
  
      private OutputWriter writeln() {
        return write((byte) '\n');
      }
  
      private OutputWriter writeln(String s) {
        return write(s).writeln();
      }
  
      private void innerFlush() {
        try {
          outputStream.write(outputBuffer, 0, outputBufferIndex);
          outputBufferIndex = 0;
        } catch (IOException e) {
          throw new IllegalStateException("Failed to inner flush");
        }
      }
  
      @Override
      public void close() {
        flush();
      }
    }
  }