#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const pair&p){ os< ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,pair&p){ is>>p.first>>p.second; return is; } template istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } ll mod; ll pow_mod(ll x, ll n){ if(n==0) return 1; ll ret=pow_mod((x*x) % mod, n/2); if(n&1) ret=(ret*x)%mod; return ret; } signed main(){ int n;cin>>n; while(n--){ cin>>mod; for(int i=1;;i++){ if(pow_mod(2,i)==i%mod){ cout<