#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int n[5] = {0};
const int N = 150;
void Pow(long long int *P){
for(int i = 1; i <= N; i++){
P[i-1] = pow(i,5);
}
}
int * Eu(int be, int en, long long int *P, int *n, int j){
for (int i = be; i < en; ++i){
if (n[4] == 0) return n;
P[N] += P[i]; n[j] = i;
if (i < 3)
n = Eu(i, en, P, n, j + 1);
else {
size_t k = lround(pow(P[i], 0.2));
if (P[k] == P[N]) n[4] = k;
}
P[N] -= P[i];
}
return n;
}
int * Eu(long long int *P, int en){
n[4] = 0;
return Eu(1, en, P, n, 0);
}
int main(){
long long int P[N+1];
Pow(P);
int en;
cin >> en;
Eu(P, en);
for (int i =0; i < 5; i++)
cout << n[i] << " ";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDx2ZWN0b3I+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG5bNV0gPSB7MH07CmNvbnN0IGludCBOID0gMTUwOwoKdm9pZCBQb3cobG9uZyBsb25nIGludCAqUCl7Cglmb3IoaW50IGkgPSAxOyBpIDw9IE47IGkrKyl7CgkJUFtpLTFdID0gcG93KGksNSk7Cgl9Cn0KCmludCAqIEV1KGludCBiZSwgaW50IGVuLCBsb25nIGxvbmcgaW50ICpQLCBpbnQgKm4sIGludCBqKXsKICAgIGZvciAoaW50IGkgPSBiZTsgaSA8IGVuOyArK2kpewogICAgICAgIGlmIChuWzRdID09IDApIHJldHVybiBuOwogICAgICAgIFBbTl0gKz0gUFtpXTsgbltqXSA9IGk7CiAgICAgICAgaWYgKGkgPCAzKQoJCQluID0gRXUoaSwgZW4sIFAsIG4sIGogKyAxKTsKICAgICAgICBlbHNlIHsKICAgICAgICAgICAgc2l6ZV90IGsgPSBscm91bmQocG93KFBbaV0sIDAuMikpOwogICAgICAgICAgICBpZiAoUFtrXSA9PSBQW05dKSBuWzRdID0gazsKICAgICAgICB9CiAgICAgICAgUFtOXSAtPSBQW2ldOwogICAgfQogICAgcmV0dXJuIG47Cn0KCmludCAqIEV1KGxvbmcgbG9uZyBpbnQgKlAsIGludCBlbil7CgluWzRdID0gMDsKCXJldHVybiBFdSgxLCBlbiwgUCwgbiwgMCk7Cn0KCmludCBtYWluKCl7Cglsb25nIGxvbmcgaW50IFBbTisxXTsKCVBvdyhQKTsJCglpbnQgZW47CgljaW4gPj4gZW47CgkKCUV1KFAsIGVuKTsKCQoJZm9yIChpbnQgaSA9MDsgaSA8IDU7IGkrKykKCQljb3V0IDw8IG5baV0gPDwgIiAiOwoJcmV0dXJuIDA7Cn0=