cin>>t; while(t--) { cin>>a; double x = pow(a,0.25); if(int(x)==x) cout<<x<<endl; else cout<<-1<<endl; }