#include typedef long long ll; using namespace std; int main(){ ll q; cin >> q; map m; m[1] = 1; vector row; row.emplace_back(1); for(ll i = 1; i < 2000; i++){ vector cur; cur.emplace_back(1); for(ll j = 1; j < i; j++){ ll num = row[j] + row[j - 1]; cur.emplace_back(min(num, (ll) 1e11)); if(num != 1e11 && m.count(num) == 0) m[num] = i + 1; } cur.emplace_back(1); row = cur; } for(ll i = 0; i < q; i++){ ll n; cin >> n; if(m.count(n) == 0){ long double x = sqrt(1 + 8 * n); if(x - (ll) x == 0){ ll row = (1 + x) / 2; cout << row + 1 << "\n"; }else cout << n + 1 << "\n"; }else cout << m[n] << "\n"; } return 0; }