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