#include<bits/stdc++.h>
#define int long long
using namespace std;
namespace IO{
template<typename T> inline void read(T &x){
bool f=1;x=0;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=0;ch=getchar();}
while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+(ch&15),ch=getchar();
x=f?x:-x;
}
template<typename T> inline void write(T x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(('0'+x%10));
}
template <typename T,typename ...Args> inline void read(T &x,Args &...args){read(x);read(args...);}
template<typename T> inline void write(T x,char c){write(x),putchar(c);}
}
using namespace IO;
int l,q,x;
unordered_map<int,int> st;
signed main(){
read(l,q);
for(int i=-l;i<=l;++i)st[i*i*i]=1;
while(q--){
read(x);
int f=1;
for(int a=-l;a<=l;++a){
for(int b=-l;b<=l;++b){
if(st[x-a*a*a-b*b*b]){
cout<<a<<" "<<b<<" "<<pow(x-a*a*a-b*b*b,(double)1/3)<<"\n";
f=0;
break;
}
}
if(!f)break;
}
if(f)cout<<l+1<<" "<<l+1<<" "<<l+1<<"\n";
}
return 0;
}