// |******In the name of ALLAH,the Beneficent,the Merciful******|
// coded by Rafi
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
// #pragma comment(linxer, "/STACx:2000000") // use to increase stacx size
// using namespace __gnu_pbds; // use to maxe ordered_set
// template <typename T>
// using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // ordered set
// #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using lll = __int128_t;
#define Taratari ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define yes printf("YES\n")
#define no printf("NO\n")
#define pi 2 * acos(0.0)
#define all(v) v.begin(), v.end()
#define endl "\n"
const int N = 2e6, inf = INT_MAX, mod = 1e9 + 7;
std::ostream &
operator<<(std::ostream &dest, __int128_t value);
int cnt[N+9];
bool vis[N+9];
vector<pair<int, int>> v;
void sieve()
{
cnt[1] = 0;
v.push_back({0, 0});
v.push_back({0, 1});
for (int i = 2; i <= N; i++)
{
if (!vis[i])
for (int j = i; j <= N; j += i)
{
int temp = j;
while (temp % i == 0)
{
cnt[j]++;
temp /= i;
}
vis[j] = true;
}
v.push_back(make_pair(cnt[i], i));
}
sort(v.begin(), v.end());
}
template <typename T>
void solve(T case_number)
{
// for (int i = 0; i < 100; i++)
// cout << v[i].first << " " << v[i].second << endl;
int n;
cin >> n;
cout << v[n].second << endl;
}
int main()
{
Taratari;
sieve();
int Testcase = 1, index = 1;
cin >> Testcase;
while (Testcase--)
{
// cout << "Case " << index << ": ";
solve(index);
index++;
}
return 0;
}
std::ostream &
operator<<(std::ostream &dest, __int128_t value)
{
std::ostream::sentry s(dest);
if (s)
{
__uint128_t tmp = value < 0 ? -value : value;
char buffer[128];
char *d = std::end(buffer);
do
{
--d;
*d = "0123456789"[tmp % 10];
tmp /= 10;
} while (tmp != 0);
if (value < 0)
{
--d;
*d = '-';
}
int len = std::end(buffer) - d;
if (dest.rdbuf()->sputn(d, len) != len)
{
dest.setstate(std::ios_base::badbit);
}
}
return dest;
}
/*
data:
1)equal_range(.begin(),.end(),value);
:: return iterator of lower_bound(value) & upper_bound(value);{pair maybe}
2)binary_search()
:: return true or false
3)next_permutation()
:: return next permutation of a string
4)unique()
::return iterator where single unique value are placed
1 2 2 2 3 3 2 1 1 4 => 1 2 3 2 1 4 2 1 1 4
::we can use resize to get only unique value in vector
=> variable_name.resize(unique(v.begin(),v.end())-v.begin());
5)maxing structure:
::struct info
{
ll maximum;
ll minimum;
} tree[400009];
::accessing by tree[index].maximum,tree[index].minimum
6)priority queue:
::typedef data_type(pair<ll, pair<ll, ll>>) pi;
::priority_queue<pi, vector<pi>> p; -> "increasing order"
::priority_queue<pi, vector<pi>, greater<pi>> p; -> "decreasing order"
7)__builtin_popcountll(number)
::count number of 1 in a number
8)o_set<data_type> variable; -> xind of a set but can find the value in index
::variable.find_by_order(index) -> find the value in index return iterator
::variable.order_of_xey(value) -> find number of value less then value
*/
// First greedy
// Use sorting
// Use dp [dynamic programming]
// Use recursive
// Use dfs
// Use math
// Use bit masxing
// Maxe equation sorter[a.u - b.u < a.v - b.vqe]
/*
.
`;|$&@&$%%%|||%%$&@&%' .
'$$%|!!!;;;!!!||%$@@&%;' .:%&&%!:::::::::::::::::::::|!..
.||:::::::::::::::::::::::;|$@$!` `|&$!::::::::::::::::::::::::::::!|'.
;%:::::::::::::::::::::::::::::::;|&&!` `|&$!:::::::::::::::::::::::::::::::::!%:.
`||:::::::::::::::::::::::::::::::::::::!$&|' '%&|::::::::::::::::::::::::::::::::::::::;%;.
:%;:::::::::::::::::::::::::::::::::::::::::!$@&;. '%@%;::::::::::::::::::::::::::::::::::::::::::%!`
!%:::::::::::::::::::::::::::::::::::::::::::::!%&@&!. .!&@$|:::::::::::::::::::::::::::::::::::::::::::::%!`
.||:::::::::::::::::::::::::::::::::::::::::::::::;|$$&@&;.'%@@@@$!``%@&$%!:::::::::::::::::::::::::::::::::::::::::::::::|!'
`|!:::::::::::::::::::::::::::::::::::::::::::::::;!|%$$&@$;:::::;|&@&$%!:::::::::::::::::::::::::::::::::::::::::::::::::||'
:|;::::::::::::::::::::::::::::::::::::::::::;%&@@@@$%|!!;:::::;!|%&@##@&$$%!:::::::::::::::::::::::::::::::::::::::::::::||:
:%;:::::::::::::::::::::::::::::::::::!%&@$|;'````.```..```...```..``..```:|&@@|;:::::::::::::::::::::::::::::::::::::::::||:
:%;::::::::::::::::::::::::::::::!$&|:`.`..................................`````;$&|;:::::::::::::::::::::::::::::::::::::||'
:%;::::::::::::::::::::::::::|&$:`.........``.................................`.````;$$!::::::::::::::::::::::::::::::::::||'
'|!::::::::::::::::::::::;%$!`.`````.................................................``:%$!:::::::::::::::::::::::::::::::%!`
`||:::::::::::::::::::;|$!`..```.......................................................```;$%;::::::::::::::::::::::::::::%!`
!|:::::::::::::::::!$%'`.............................................................``..``'%&|;::::::::::::::::::::::::;%;.
;%;::::::::::::::!$!```..............................................................`...````'%@$|;:::::::::::::::::::::!%:.
'|!::::::::::::!$!`.`....................................................................``````'%&$$|:::::::::::::::::::||`.
.!|::::::::::;%! ..........................................................................````;&&$$%;::::::::::::::::%! .
:%;::::::::%%` ...````````.........`.............................................```.``.'%&$%$%!:::::::::::::;%; .
.!|::::::!%; . .....```..```````````.``........................................``!&$$%%%!:::::::::::!|' .
:|;::::|%' .. ....``..........................................:$&$$$$%;:::::::::%! .
!%::;%|'``..... .....```..................................................````:$&$$%$$|;::::::!%' .
'|!;%|`.......`.`.........````````..`.......```...........`````.................................````:%&$$$$$%!:::::%! .
;$$|`...`':'..`.`````....`````|!`````...................```.````.................`....````..........:$&$%%%%$|:::!|' .
.||``.``'|!```...........``.`:|;````;!'.``..............```.::```...................`'!:.`.......`..`;$&%%%$$$|;;%; .
;|'...``!|'``.`````..........;|:``.:$|`...................``;|:......................'|!```.......``.`!&$%%$%$$%$! .
:|:.``..'|!.``..``````......``!%:.`:%&|```...............```'!%|:````.`....```.......`'|!..............'%&$%$$$$@|. .
`|;..````:|:..``;|'.```.......`;%;`:%&#!```..................:|$%:``'|!``````.......```'|!``..........```;$&$%$$@|. .
!|``...``;|:`..'%%'..```..```:%&&!'!&&$!`.```.``..........```;%&%```|&;``:%!```....```.'|;.``...`.``..`.``|&$$$@| .
:|:.``````;|:``;$@%:````````'|$;:%%;%&!||`....`''........``..:|$&!``!&&&;``|#$'``....``.:|;`````..`!|'``..`:$&&&; .
!!````||``:|;`!$@#$:`....``:%|:::;$$$%`;|'....`:'...........`;%&%:`!$;:!&%'!$$&!`...```.;|'`..```..;$;....``|#&$; .
:|:..`:%;```||;%&@@&;``````;$!:'` .;&@; `|;````.::`........``:|%&!`|$;:` `|$$|;%@@|'....`||`````..``;$|'..```;%!||. .
|!.```!|'```;$%$&$&&|'`'|$$&|:'. `'. !|`..`.';'.........'!%&%;|%:'. '%@#&: `|&%:```:|;`````````;$%:```..'||!%: .
'|:```'%!`..``!&&&%$&%:`.`:%%|$@&!` `|!```.'!;`....``.`;|$&%%%:;|&$:. :&@%;`!|`.`````..`;$$;::`.``!%;%! .
!|`..`!$;..`..:&@$|%&&!'`'%%:` .;$@$:. :|:...`;|;`.`.`..:|%&@&&%:. .|&$&@$;.....`````;$$!!!'..`;%;!|` .
.|!`..:$%'```.`;||||%&@$;`!%;` '!!|%:.``;|!'```..'!%&#&;'. !&;````.......```;$$||!'..`:%!;%; .
`|;..`!&|````.:!||||%&&&%|%!'. :%;``;||;````'!|$@%:` `:|$@#####%` :$!``..``........;$%|||:`.`'||:%! .
'|:..:|&|`''``:|||||%&%'%@!.;@@@#####@&$|!'. `|!';|%!'```;%$&||&&@@@@@&&&&&@#| :$|'``.......``.`!$%|||;```'||:||` .
:|'.`;%&!.:;``;|||||%&%` `|@&&&&&&&&&&@&' ;&$%|!'.`;|$&;.!@&&&&&&&&&&&@#|. '%|'``.......````!&%||%!`.`'||:;%: .
:|'.`;%$!`;!'`;|||||%&|. '%|;%&&&&&&&&@$` !&$|:`;%&%` !%`.!&&&&&$$$$@%` '%|'``.```...````|&%|||!'.`'||:;%; .
:|'.'!%$!`;|:`;|||||%&|. :; `|%|%%|||$|. ;$|;$&; :: `!%%|%||||&%` '%%'``.```.''```'%$%|||!'.`'||::%! .
'|:`:|%$!`;|;`;|||||%&! ;$||||%|%%|||&; .'` '%|||||%%%||||&%. '%|'``...`.':`.`:%$|||||:..:|!::||. .
`!;.:|%&!`;||:;||||%$&; ;$||||||||||$%' .|$|||%%%%|||%@| '$|'.`..`.`:!:``!$%|||||:``;$!::!|` .
.||`:|%&|`;||;;||||%&%` '%%||%%%||%%&! :%|||%|||%||$$' :$!`..`````;|:``|&||||||:.`|&!::!|' .
`$%''!|&%';||||||||%&! !$|'.```:|&%. ;$%' :$&: ;$!`......:||:`:%$||||||:.:$$;::!%: .
'$&;'!|$$::|||||||%&%` .|&: .!@|. .|&|`.`;&$' !&;`....``;||;`!$%||||||:`!&%;::!%: .
:%$|';|%&!'!||||||%&%' ......`!@##@!. '|&&|'.`.... .|$:...```:|||;'%$|||||%$;:$&|;::!%: .
;%;%|;||&$::||||||%$$:..``````````. ;; ...````````..`|%'....`'!|||:;$%||||%$$!|&$|;::!%: .
;%;|$|!|%&|`;%|||||%&!..`````````... .|#################@@$;. ..``````````.:$|'```.`;||||;%$||%%%%&$%&$%|:::!|' .
:|;;%&$||%$;:$$||||%&%'..````````.. '$##&;``````````````:$&' ..```````.. ;$!`````:||||!%$%|$&$|$#@&$%%!:::||` .
'|!:|$@&%%$$;;&$||||%&|. ........ :@$:`````````````````|$: ...... !$:.```'!%%||%$%|%&@$$##@$%$%;:::|!. .
!%:!%$@&%%@@!%@%||||%&%` '$!``````````````````|%` `%%'``.'!%&&%$@$%%&#&@##@$%%$|;:::%! .
`%&&@$|!$&&$$#&&$%|||%&#%` .|$:````````````````:%: :$!````;|$&%%@&%$&%&@; `|@@&%;:::;|: .
'&&';!:%&%|||$&$$@$: .|&;``````````````;%: .;&@@$:`.`;|$@$$@&$&|'%%. .:|$&@|. .
`' ;&$||%&&%||%&@|` `%&!``````````:%!. `!&@$%%%&|`.`:|$@&&#@&$: .
!&$%%&#@%|||%$&@%' .';;'`...''. `!&#&%|||||%$$;`.:%&#@@#@@!. .
.;%&&$$&! :&&$&%|@$%%&@$%%$@#@|:. .`;%&@&@$:``:%&$%%%&@%``:%@#@||#|!$!'';|$@! .
;&%:```'|$: :$#%.`|@@@%!&#&;```':;|&#@@@@@@@&$%|!;:::|&!. '$%``|;`;&|. .;!|$;``'!%&@; .
.%&$$$%|;;$%` `%$!':%%` `|&|::::::::::;$%` ;&$!|%|&|. `%@$$&&&&@#%` .
`;;;;;;;;;;` || '$; :$|:::::'!&! `%|. !|` !|. .::. .
*/