fork download
  1.  
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. ///#define int long long
  5. #define ll long long
  6. #define ln '\n'
  7. #define u unsigned
  8. #define f first
  9. #define ss second
  10.  
  11. ll logg(ll base ,ll x){
  12. ll s=0;
  13. if(!x)return 1;
  14. while(x){
  15. x/=base;
  16. s++;
  17. }
  18. return s;
  19. }
  20. const ll N=1000000007;
  21. const ll mod=998244353;
  22.  
  23. ll fastPow(ll x,ll y,ll mode){
  24. if(y==0)
  25. return 1;
  26. //
  27.  
  28. if(y%2==1){
  29. ll b=x%mode;
  30. ll ans=fastPow(b,y/2,mode)%mode;
  31. ans=(ans*ans)%mode;
  32. return (ans*b)%mode;
  33. }
  34.  
  35. else{
  36. ll b=x%mode;
  37. ll ans=fastPow(b,y/2,mode)%mode;
  38. ans=(ans*ans)%mode;
  39. return ans;
  40. }
  41.  
  42. }
  43.  
  44. ll power(ll x, ll y,ll mode)
  45. {
  46. ll res = 1;
  47. x = x % mode;
  48.  
  49. while (y > 0) {
  50. if (y & 1)
  51. res = (res * x) % mode;
  52. y = y >> 1;
  53. x = (x * x) % mode;
  54. }
  55.  
  56. return res;
  57. }
  58. u ll GCD(u ll a, u ll b)
  59. {
  60. return b == 0 ? a : GCD(b, a % b);
  61. }
  62. u ll lcm(u ll x,u ll y){
  63. return (ll)(((x/(ll)__gcd(x,y)))*y);
  64. }
  65. ll ceiling (ll x,ll y){
  66. if(x%y)return x/y +1;
  67. return x/y;
  68. }
  69. bool sortby(const pair<ll,ll>&a,const pair<ll,ll>&b){
  70. if(a.first==b.first)
  71. return a.second>b.second;
  72. return a.first<b.first;
  73. }
  74. ////////////////////////////////////////
  75. ll fact[100000],invfact[100000];
  76. ll invMod(ll x,ll mode){
  77. return fastPow(x,mode-2,mode)%mode;
  78. }
  79. void factorial(ll mode){
  80. ll ff=1;
  81. fact[0]=1;invfact[0]=1;
  82. for(ll i=1;i<=3010;i++){
  83. ff*=i;ff%=mode;
  84. fact[i]=ff;
  85. invfact[i] = invMod(fact[i],mode);
  86.  
  87. }
  88. }
  89.  
  90.  
  91. ll ncr(ll n,ll r,ll mode){
  92. return ( (fact[n]* invfact[r])%mode* invfact[n-r])%mode;
  93. }
  94. ///////////////////////////////////////////////
  95. bool isPrime(ll n){
  96. if(n == 1){
  97. return false;
  98. }
  99. for(ll i = 2; i*i<=n; i++){
  100. if(n%i == 0){
  101. return false;
  102. }
  103. }
  104.  
  105. return true;
  106. }
  107.  
  108. int on_bits(long long n){ return __builtin_popcountll(n);}
  109. //////////////////////////////////////////////////
  110. void Update(vector<ll>&B,int idx,ll val){
  111. while(idx<B.size()){
  112. B[idx]+=val;
  113. idx+=(idx&-idx);
  114. }
  115. }
  116. ll get_sum(vector<ll>&B,int l,int r){
  117. ll s1=0,s2=0;l=max(l-1,0);
  118. while(l){
  119. s1+=B[l];
  120. l-=(l&-l);
  121. }
  122. while(r){
  123. s2+=B[r];
  124. r-=(r&-r);
  125. }
  126. return s2-s1;
  127. }
  128. //////////////////////////////////////////
  129.  
  130. bool valid(int x,int uu){
  131. if(x>=0 && x<uu)return 1;
  132. return 0;
  133. }
  134. ll pow2[200010];
  135. void power2(){
  136. ll p=1;
  137. pow2[0]=1;
  138. for(int i=1;i<=200000;i++){
  139. p*=2;p%=N;
  140. pow2[i]=p;
  141. }
  142. }
  143. ll sum_(ll l,ll r){
  144. return (r*(r+1))/2-(l*(l+1))/2;
  145. }
  146. bool is_pal(string s){
  147. string s2=s;
  148. reverse(s2.begin(), s2.end());
  149. return s==s2;
  150. }
  151. ///MiraculousN
  152. void change(int &x,int& y){
  153. if(x==-1 && y==1)y=-1;
  154. else if(x==-1 && y==-1)x=1;
  155. else if(x==1 && y==-1)y=1;
  156. else x=-1;
  157. }
  158.  
  159. void solve(){
  160. ll n;cin>>n;
  161. if(n%2==0){
  162. cout<<n<<' '<<2*n<<ln;
  163. return;
  164. }
  165. ll i=4;
  166. while(i*n<=1e10){
  167. if(lcm(i-1,n)==((i-1)*n) && isPrime(i-1)){///
  168. cout<<(i-1)*n<<' '<<i*n<<ln;
  169. return;
  170. }
  171. if(lcm(i+1,n)==((i+1)*n) && isPrime(i+1)){
  172. cout<<(i)*n<<' '<<(i+1)*n<<ln;
  173. return;
  174. }
  175. i*=2;
  176. }
  177. }
  178.  
  179. int main()
  180. {
  181. ios_base::sync_with_stdio(0);
  182. cin.tie(0);cout.tie(0);
  183. int T=1;cin>>T;
  184. /// map_pow();
  185. //power2();
  186. //factorial(N);
  187. while(T--){
  188. solve();
  189. }
  190. return 0;
  191. }
  192.  
  193. /*
  194. 4
  195. 1 2 3 4
  196. 6
  197. 3 5 6 7 1 2
  198.  
  199. 10
  200. 7 10 1 2 1 7 1 5 9 9
  201. 9
  202. 6 2 5 6 7 7 5 5 2
  203.  
  204. 2
  205. 6 10
  206. 3
  207. 6 3 3
  208.  
  209.  */
Success #stdin #stdout 0.01s 5496KB
stdin
Standard input is empty
stdout
0 0