#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
void solve(){
for(int x=0;x<=n;x++){
for(int y=0;y<=n;y++){
for(int z=0;z<=n;z++){
if(3 * x + 5 * y + 7 * z == n){
cout << x << " " << y << " " << z << endl;
return;
}
}
}
}
cout << -1 << endl;
}
int main()
{
int t;
scanf("%d",&t);
while(t -- ){
scanf("%d", &n);
solve();
}
return 0;
}