#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; while(n--) { int x; cin>>x; int t=1; for(int b=1; pow(b,4)<=x; b++) { if(pow(b,4)==x) { cout<<b<<endl; t=0; } } if(t==1) { cout<<"-1"; } } }