#include using namespace std; //#define int long long #define f(i,a,b) for(int i = (a); i < (b); ++i) using ll = long long; signed main() { ios_base::sync_with_stdio(0); int q; cin >> q; map res; res[1] = 1; for (ll i = 1; i <= 1e5; ++i) { ll prod = 1; for (ll j = 0; j <= (i + 1) / 2; ++j) { prod *= i - j; prod /= j + 1; if (prod > 1e9) break; if (res.find(prod) == res.end()) res[prod] = i + 1; } } while (q--) { int n; cin >> n; if (res.find(n) == res.end()) cout << n + 1; else cout << res[n] << '\n'; } return 0; }