#include <bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
if(n%4 == 0 && n%6==0){
cout<<n/6<<" "<<n/4<<endl;
}
if(n%4 == 0 && n%6!=0){
cout<<n/6<<" ";
}
if(n%4 == 0 && n%6==0){
cout<<n/4;
}
cout<<-1<<endl;
}
int main() {
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIHNvbHZlKCl7CglpbnQgbjsKCWNpbj4+bjsKCQoJaWYobiU0ID09IDAgJiYgbiU2PT0wKXsKCQljb3V0PDxuLzY8PCIgIjw8bi80PDxlbmRsOwoJfQoJaWYobiU0ID09IDAgJiYgbiU2IT0wKXsKCQljb3V0PDxuLzY8PCIgIjsKCX0KCWlmKG4lNCA9PSAwICYmIG4lNj09MCl7CgkJY291dDw8bi80OwoJfQoKCgljb3V0PDwtMTw8ZW5kbDsKCgoKCgoKCgoKCgp9CmludCBtYWluKCkgewoJaW50IHQ7CgljaW4+PnQ7Cgl3aGlsZSh0LS0pewoJCXNvbHZlKCk7Cgl9CglyZXR1cm4gMDsKfQ==