文件目录

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int ans = -1, a, b, c;
        scanf("%d", &a);
        c = sqrt(a);
        if (c * c == a)
        {
            b = sqrt(c);
            if (b * b == c)
                ans = b;
        }
        printf("%d\n", ans);
    }
    return 0;
}