def make_array(pol,odd_pol)
  i=1
  while pol[-1]<1000000
    i+=1
    if (s=(i*(i+1)*(i+2))/6)%2==1
      odd_pol.push(s)
    end
    pol.push((i*(i+1)*(i+2))/6)
  end
  return [pol,odd_pol]
end


def solve(x,pol)
  l=pol.length
  count=0
  tmp=x
  for i in 0..l-1
    while tmp>=pol[l-1-i]
      tmp-=pol[l-1-i]
      count++
    end
  end
  return count
end

def odd_solve(x,odd_pol)
  l=odd_pol.length
  count=0
  tmp=x
  for i in 0..l-1
    while tmp>=odd_pol[l-1-i]
      tmp-=odd_pol[l-1-i]
      count++
    end
  end
  return count
end

pol=make_array([1],[1])[0]
odd=make_array([1],[1])[1]
while (n=gets.to_i)!=0
  print solve(n,pol)," ",odd_solve(n,odd),"\n"
end