/* 
   AOJ 1167
   Pollock's conjecture
   
*/

#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
int *a, min;

void dfs_odd(int x, int i, int c)
{
  if(min < c)
    {
      return ;
    }
  for(; i > 0; i--)
    {
      if(a[i] % 2 == 0)
	continue;
      if(x - a[i] == 0)
	{
	  if(min > c)
	    {
	      min = c;
	      return ;
	    }
	}
      else if(x - a[i] > 0)
	dfs_odd(x - a[i], i, c + 1);
    }
  return ;
}

void dfs(int x, int i, int c)
{
  if(min < c)
    {
      return ;
    }
  for(; i > 0; i--)
    {
      if(x - a[i] == 0)
	{
	  if(min > c)
	    {
	      min = c;
	      return ;
	    }
	}
	
      else if(x - a[i] > 0)
	dfs(x - a[i], i, c + 1);
    }
  return ;
}



int main(void)
{
  int x, i, max_a;
  for(i = 1; i * (i + 1) * (i + 2) / 6 < 1000000; i++);
  max_a = i;
  a = malloc(sizeof(int) * max_a);

  for(i = 1; i < max_a; i++)
    {
      a[i] = i * (i + 1) * (i + 2) / 6;
    }
  int m;
  while(scanf("%d", &x), x)
    {
      min = INT_MAX;
      for(i = 1; x >= a[i]; i++);
      m = i - 1;
      dfs(x, m, 1);
      printf("%d ", min);
      min = INT_MAX;
      dfs_odd(x, m, 1);
      printf("%d\n", min);
    }
  return 0;
}