t = Array.new(180)
(180).times do |i|
    t[i] = (i*(i+1)*(i+2))/6
end
ot = t.select{|e| e.odd?}
dp = Array.new(10**6+1,Float::INFINITY)
dp[0] = 0
dp2 = Array.new(10**6+1,Float::INFINITY)
dp2[0] = 0

t.each do |tn|
    if tn % 2 == 0
        tn.upto(10**6) do |i|
            dp[i] = dp[i - tn] + 1 if dp[i - tn] + 1 < dp[i]
        end
    else
        tn.upto(10**6) do |i|
            dp[i] = dp[i - tn] + 1 if dp[i - tn] + 1 < dp[i]
            dp2[i] = dp2[i - tn] + 1 if dp2[i - tn] + 1 < dp2[i]
        end
    end
end
loop do
    n = gets.to_i
    break if n == 0
    puts "#{dp[n]} #{dp2[n]}"
end