#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); long long all = 9872/8; vector> V(all+all+all); for(int v=0; v use+use-sum) best = use+use-sum,V.at(v) = {a,b,c,d}; } } } //if(!ok){cout << v << " " << best << endl;} } int T; cin >> T; while(T--){ long long N; cin >> N; if(N%8){cout << "-1\n"; continue;} N /= 8; if(N < all+all+all){ auto [a,b,c,d] = V.at(N); long long use = max({a,b,c,d}),sum = a+b+c+d; if(use+use >= sum) cout << "-1\n"; else cout << a << " " << b << " " << c << " " << d << "\n"; } else{ long long pos = N%all; N -= all*3+pos; auto [a,b,c,d] = V.at(pos+all+all); assert(N%all == 0); cout << a+all << " " << b+all << " " << c+all << " " << d+all << "\n"; } } }