object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N = ni()
    val (from, to) = na2(N - 1, -1)
    val g = packUGraph(N, from, to)
    val (c, diameter, radius) = centerOfTree(g)

    def calcTwoCenter(c1: Int, c2: Int): Long = {
      val depthMaxChildren = mutable.Map[Int, Long]().withDefaultValue(0)
      calcFrom(c1, depthMaxChildren, c2)
      calcFrom(c2, depthMaxChildren, c1)
      depthMaxChildren.values.product * 2
    }

    def calcOneCenter(c: Int): Long = {
      val depthMaxChildren = mutable.Map[Int, Long]().withDefaultValue(0)
      calcFrom(c, depthMaxChildren, INF)
      depthMaxChildren.values.product
    }

    def calcFrom(c: Int, depthMaxChildren: mutable.Map[Int, Long], blocked: Int): Unit = {
      val (depth, _, _) = traceBfs(g, c, blocked)
      rep(N) { i =>
        val d = depth(i)
        if (d != INF) {
          // 葉の数はノード毎に子供の数をかけていったもの
          val size = if (g(i).length == 1) 1
          else {
            // 葉でなければ子の数を数える
            var size = g(i).length
            if (d != 0) size -= 1  // ルートでなければ親の分を引く
            if (g(i).contains(blocked)) size -= 1 // blockされてるエッジを引く
            size
          }

          depthMaxChildren(d) = max(depthMaxChildren(d), size)
        }
      }
    }

    val colors = diameter / 2 + 1
    if (c.length == 2) {
      out.println(s"$colors ${calcTwoCenter(c(0), c(1))}")
    } else {
      val ms = min(g(c(0)).map(calcTwoCenter(c(0), _)).min, calcOneCenter(c(0)))
      out.println(s"$colors $ms")
    }
  }

  /**
    * すでに直径、直径のノードがわかっている場合は、直径の半分だけ親をたどればいいのでもっと楽にできる
    * @return (木の中心１こor２個, 直径, 半径)
    */
  def centerOfTree(t: Array[Array[Int]]): (Array[Int], Int, Int) = {
    val n = t.length

    var cur = 0
    var p = 0
    val queue = Array.ofDim[Int](n)
    val degree = Array.ofDim[Int](n)
    val lvl = Array.ofDim[Int](n)
    rep(n) { i =>
      degree(i) = t(i).length
      if (degree(i) == 1) {
        queue(p) = i
        p += 1
      }
    }

    while(cur < p) {
      val v = queue(cur)
      cur += 1
      rep(t(v).length) { i =>
        val u = t(v)(i)

        // parentを探す
        if (degree(u) > 0) {
          degree(u) -= 1
          if (degree(u) == 1) {
            lvl(u) = lvl(v) + 1
            queue(p) = u
            p += 1
          }
        }
      }
      degree(v) -= 1
    }

    val c1 = queue(n - 1)
    if (n >= 2 && lvl(c1) == lvl(queue(n - 2))) {
      val c2 = queue(n - 2)
      (Array(c1, c2), lvl(c1) * 2 + 1, lvl(c1) + 1)
    } else {
      (Array(c1), lvl(c1) * 2, lvl(c1))
    }
  }

  /**
    * @param n ノード数
    */
  def packUGraph(n: Int, from: Array[Int], to: Array[Int]): Array[Array[Int]] = {
    val t = new Array[Array[Int]](n)
    val p = new Array[Int](n)
    val m = from.length
    rep(m)(i => p(from(i)) += 1)
    rep(m)(i => p(to(i)) += 1)
    rep(n)(i => t(i) = new Array(p(i)))
    rep(m) { i =>
      p(from(i)) -= 1
      t(from(i))(p(from(i))) = to(i)
      p(to(i)) -= 1
      t(to(i))(p(to(i))) = from(i)
    }
    t
  }

  val INF = 1e9.toInt + 10

  /**
    * @return (depth, parent, queue)
    */
  def traceBfs(g: Array[Array[Int]], rt: Int = 0, blocked: Int): (Array[Int], Array[Int], Array[Int]) = {
    val n = g.length
    val q, p = Array.ofDim[Int](n)
    q(0) = rt
    p(rt) = -1
    val d = Array.fill[Int](n)(INF)
    d(rt) = 0
    var cur = 0
    var last = 1
    while (cur < last) {
      val v = q(cur)
      rep(g(v).length) { i =>
        val u = g(v)(i)
        if (d(u) == INF && u != blocked) {
          d(u) = d(v) + 1
          p(u) = v
          q(last) = u
          last += 1
        }
      }
      cur += 1
    }
    (d, p, q)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    rep(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    rep(n) { i =>
      rep(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def rep(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def rep_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    rep(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Int](as.length + 1)
    rep(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

Measured memory_bytes: 28324