#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int tetrahedral[200];
int tetrahedralOdd[200];
int map[1000000], oddmap[1000000];

void init()
{
	int i;
	for (i = 0; i < 200; i++)
	{
		tetrahedral[i] = ((i + 1) * (i + 2) * (i)) / 6;
	}
	for (i = 0; i < 1000000; i++)
	{
		map[i] = oddmap[i] = 1000000;
	}
	map[0] = oddmap[0] = 0;
	map[1] = oddmap[1] = 1;
	for (i = 2; i < 1000000; i++)
	{
		for (int j = 1; tetrahedral[j] <= i; j++)
		{
			if (map[i] > map[i - tetrahedral[j]] + 1)
				map[i] = map[i - tetrahedral[j]] + 1;
			if (tetrahedral[j] % 2 && oddmap[i] > oddmap[i - tetrahedral[j]] + 1)
				oddmap[i] = oddmap[i - tetrahedral[j]] + 1;
		}
	}
}

int main()
{
	init();
	for (int input, out1, out2; (scanf("%d", &input)) && input != 0; printf("%d %d\n", out1, out2))
	{
		out1 = map[input];
		out2 = oddmap[input];
	}
	return 0;
}
