import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val tetra = Array(180, { 0 })
    var (_i, _n) = Pair(1, 1)
    while (_n < 1000000) {
        tetra[_i-1] = _n
        _n = ++_i*(_i+1)*(_i+2)/6
    }
    val tetra_odd = Array(45, { 0 })
    var (__i, __j, __n) = arrayOf(1, 0, 1)
    while (__n < 1000000) {
        if (__n.and(1) == 1) {
            tetra_odd[__j] = __n
            __j++
        }
        __n = ++__i*(__i+1)*(__i+2) / 6
    }
    val dp = IntArray(1000001)

    while (true) {
        val N = sc.nextInt()
        if (N == 0) break
        dp.fill(1000000, 1)
        dp[0] = 0
        for (n in tetra) {
            if (n > N) break
            for (i in n..N) {
                dp[i] = Math.min(dp[i], dp[i-n] + 1)
            }
        }
        val ans = dp[N]
        dp.fill( 1000000, 1)
        for (n in tetra_odd) {
            for (i in n..N) {
                dp[i] = Math.min(dp[i], dp[i-n]+1)
            }
        }
        println("${ans} ${dp[N]}")
    }
}
