#include <stdio.h>

int main() {
  int N;
  int simen[1000];
  int i, j;
  int value, newValue;
  int data1[1000000], data2[1000000];

  for(i = 0; i < 1000; i++) {
    simen[i] = i*(i+1)*(i+2)/6;
  }

  data1[0] = 0;
  for(i = 1; i < 1000000; i++) {
    data1[i] = 999999;
    for(j = 1; j <= i; j++) {
      if(simen[j] > i) break;
      newValue = data1[i-simen[j]]+1;
      if(newValue < data1[i]) data1[i] = newValue;
    }
  }

  data2[0] = 0;
  for(i = 1; i < 1000000; i++) {
    data2[i] = 999999;
    for(j = 1; j <= i; j++) {
      if(simen[j] > i) break;
      if(simen[j] % 2 == 0) continue;
      newValue = data2[i-simen[j]]+1;
      if(newValue < data2[i]) data2[i] = newValue;
    }
  }

  while(1) {
    scanf("%d", &N);
    if(N == 0) break;
    printf("%d %d\n", data1[N], data2[N]);
  }
  return 0;
}