#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = 0;
    cout << "2 " << n - 1 << endl;
  }
  return 0;
}
