#include <iostream>
#include<stdio.h>
#include<memory.h>
#include<limits.h>
#include<string.h>
using namespace std;
char str[100005];
int hashmap[300];
int main()
{
int t; cin>>t;
while(t--){
int n ; cin>>n;
if(n==4 || n == 6) cout<<1<<" "<<1<<endl;
else if(n==8|| n==10) cout<<2<<" "<<2<<endl;
else if(n<4 || n%2!=0) cout<<-1<<endl;
else{
cout<<(n+1)/6<<" "<<n/4<<endl;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZTxzdGRpby5oPgojaW5jbHVkZTxtZW1vcnkuaD4KI2luY2x1ZGU8bGltaXRzLmg+CiNpbmNsdWRlPHN0cmluZy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmNoYXIgc3RyWzEwMDAwNV07CmludCBoYXNobWFwWzMwMF07CmludCBtYWluKCkgCnsKICAgIGludCB0OyBjaW4+PnQ7CiAgICB3aGlsZSh0LS0pewogICAgICAgIGludCBuIDsgY2luPj5uOwogICAgICAgIGlmKG49PTQgfHwgbiA9PSA2KSBjb3V0PDwxPDwiICI8PDE8PGVuZGw7CiAgICAgICAgZWxzZSBpZihuPT04fHwgbj09MTApIGNvdXQ8PDI8PCIgIjw8Mjw8ZW5kbDsKICAgICAgICBlbHNlIGlmKG48NCB8fCBuJTIhPTApIGNvdXQ8PC0xPDxlbmRsOwogICAgICAgIGVsc2V7CiAgICAgICAgICAgIGNvdXQ8PChuKzEpLzY8PCIgIjw8bi80PDxlbmRsOwogICAgICAgIH0KCiAgICB9ICAgCglyZXR1cm4gMDsKfQ==