#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

ll dp1[1000010];
ll dp2[1000010];
int main(){
	rep(i,0,1000005)dp1[i]=dp2[i]=INF;
	dp1[0]=dp2[0]=0;
	rep(n,1,200){
		ll s=n*(n+1)*(n+2)/6;
		rep(i,0,1000005-s)dp1[i+s]=min(dp1[i+s],dp1[i]+1);
		if(s%2)rep(i,0,1000005-s)dp2[i+s]=min(dp2[i+s],dp2[i]+1);
	}
	ll n;
	while(scanf("%lld",&n),n){
		printf("%lld %lld\n",dp1[n],dp2[n]);
	}
	return 0;
}
