#include <stdio.h>
#include <string.h>

int numbers[180];

int memo[2][180][1000000];

int tansaku(int pos,int rest,int force_kisuu) {
	int i;
	int result=0x10000000;
	int now;
	if(rest==0)return 0;
	if(numbers[pos]>rest)return 0x10000000;
	if(memo[force_kisuu][pos][rest]>0) {
		return memo[force_kisuu][pos][rest]-1;
	}
	for(i=pos;i<180 && numbers[i]<=rest;i++) {
		if(!force_kisuu || numbers[i]%2!=0) {
			now=tansaku(i,rest-numbers[i],force_kisuu)+1;
			if(now<result)result=now;
		}
	}
	memo[force_kisuu][pos][rest]=result+1;
	return result;
}

int main(void) {
	int i;
	int query;

	for(i=0;i<180;i++)numbers[i]=i+1;
	for(i=1;i<180;i++)numbers[i]+=numbers[i-1];
	for(i=1;i<180;i++)numbers[i]+=numbers[i-1];

	while(1) {
		scanf("%d",&query);
		if(query==0)break;
		printf("%d %d\n",tansaku(0,query,0),tansaku(0,query,1));
	}
	return 0;
}