#include <stdio.h>

int N(int n){
  return n*(n+1)*(n+2)/6;
}

main(){
  int i,j,n,fx[1000000],d=1,min,fy[1000000],nn=1;

  while(1){
    scanf("%d",&n);
    if(n==0) break;
    
    
    fx[0] = 0;
    fy[0] = 0;
    for(i=nn;i<=n;i++){
      if(i == N(d+1)) d++;
      
      min = -1;
      for(j=1;j<=d;j++){
	if(min == -1 || fx[i-N(j)]+1 < min) min = fx[i-N(j)]+1;
      }
      fx[i] = min;
      
      min = -1;
      for(j=1;j<=d;j++){
	if(N(j)%2 == 0) continue;
	else if(min == -1 || fy[i-N(j)]+1 < min) min = fy[i-N(j)]+1;
      }
      fy[i] = min;
    }
    
    
    if(nn < n) nn = n+1;
    
    printf("%d %d\n",fx[n],fy[n]);
    
  }
  return 0;
}