#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  int t;
  cin >> t;
  while (t--) {
    int p;
    cin >> p;
    cout << 2 << " " << (p / 2) * 2 << endl;
  }
  return 0;
}
