### classes

class Node
  attr_accessor :nv, :nbrs, :prv

  def initialize(nv)
    @nv = nv
    @nbrs = []
    @prv = nil
  end

  def next_nv
    @nv = 3 * @nv + 1
    while (@nv & 1) == 0
      @nv >>= 1
    end
    @nv -= 12345678 if @nv > 12345678
    @nv
  end

  def leaf_bonus
    lb = (@nv + 1) / 2
    (lb & 1) == 1 ? lb : lb + 1
  end

  def root_bonus
    rb = (@nv + 1) / 2
    (rb & 1) == 1 ? rb : rb - 1
  end

  def root?
    @prv.nil?
  end
  
  def leaf?
    @nbrs.empty?
  end

  def add(nd)
    nd.prv = self
    @nbrs << nd
    nd
  end

  def to_s
    self.leaf? ?
      @nv.to_s :
      @nv.to_s + "(" + @nbrs.map{|nd| nd.to_s}.join(',') + ")"
  end
end

### global variables

### subroutines

### main

loop do
  ki = gets.to_i
  break if ki == 0

  root = Node.new(ki)
  max_n = 1
  t = 0
  #p root.to_s
  #p "t=#{t}, max_n=#{max_n}"

  loop do
    t += 1

    # 1.
    q = [root]
    n = 0
    cds = []
    max_nv = 0
    uniq_cd = nil
    
    while ! q.empty?
      u = q.shift
      unv0 = u.nv
      unbrs = u.nbrs
      uprv = u.prv

      unv = u.next_nv
      if unv == 1
        break if u.root?
        uprv.nbrs.delete(u)

        if unbrs.length == 1
          uprv.add(unbrs.first)
          q << unbrs.first
        end
        next
      end

      n += 1

      if max_nv < unv
        max_nv = unv
        uniq_cd = u
      elsif max_nv == unv
        uniq_cd = nil
      end

      if u.leaf? && unv > unv0
        cds << u
      end

      for v in unbrs
        q << v
      end
    end

    break if root.nv == 1
    
    # 2.
    for cd in cds
      lbnv = cd.leaf_bonus
      lb = Node.new(lbnv)
      cd.add(lb)
      n += 1
      
      if max_nv < lbnv
        max_nv = lbnv
        uniq_cd = lb
      elsif max_nv == lbnv
        uniq_cd = nil
      end
    end
    #p (uniq_cd ? uniq_cd.nv : nil)
    
    # 3.
    if ! uniq_cd.nil? && uniq_cd != root
      prnt = nil
      nd = uniq_cd

      while nd != root
        nd0 = nd.prv
        nd.nbrs << nd0
        nd.nbrs.delete(prnt)
        nd.prv = prnt
        prnt = nd
        nd = nd0
      end

      root.nbrs.delete(prnt)
      root.prv = prnt

      root = uniq_cd
    end

    if ! uniq_cd.nil?
      rbnv = root.root_bonus
      rb = Node.new(rbnv)
      root.add(rb)
      n += 1
    end

    max_n = n if max_n < n

    #p root.to_s
    #p "t=#{t}, max_n=#{max_n}"
  end
  #p root.to_s
  #p "finished: t=#{t}, max_n=#{max_n}"

  puts [t, max_n].join(' ')
end