object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a, b = Array.fill(n)(sc.nextInt() - 1)
  val count = Array.fill(n)(0)
  val counta = Array.fill(n)(0)
  val countb = Array.fill(n)(0)
  var idxa = Map[Int, List[Int]]().withDefaultValue(Nil)
  var idxb = Map[Int, List[Int]]().withDefaultValue(Nil)
  for (i <- 0 until n) {
    count(a(i)) += 1
    count(b(i)) += 1
    counta(a(i)) += 1
    countb(b(i)) += 1
    idxa += a(i) -> (i :: idxa(a(i)))
    idxb += b(i) -> (i :: idxb(b(i)))
  }

  if (count.max > n) {
    println("No")
  } else {
    val x = Array.fill(n+1)(Set[Int]())
    for (i <- 0 until n) {
      x(count(i)) += i
    }

    val ans = Array.fill(n)(-1)

    def update(p: Int, q: Int): Unit = {
      val idx = idxa(p).head
      ans(idx) = q + 1
      if (counta(p) == 1) {
        idxa -= p
      } else {
        idxa += p -> idxa(p).tail
      }
      if (countb(q) == 1) {
        idxb -= q
      } else {
        idxb += q -> idxb(q).tail
      }
      x(count(p)) -= p
      x(count(q)) -= q
      count(p) -= 1
      count(q) -= 1
      counta(q) -= 1
      countb(q) -= 1
      x(count(p)) += p
      x(count(q)) += q
    }

    def getAny(m: Map[Int, List[Int]], except: Int): Int = {
      m.keys.find(_ != except).get
    }

    for (i <- n until 0 by -1) {
      var p = -1
      var q = -1
      x(i).size match {
        case 0 =>
          p = getAny(idxa, -1)
          q = getAny(idxb, p)
        case 1 =>
          if (idxa(x(i).head).nonEmpty) {
            p = x(i).head
            q = getAny(idxb, p)
          } else {
            q = x(i).head
            p = getAny(idxa, q)
          }
        case 2 =>
          if (idxa(x(i).head).nonEmpty) {
            p = x(i).head
            q = x(i).last
          } else {
            p = x(i).last
            q = x(i).head
          }
      }
      update(p, q)
    }

    println("Yes")
    println(ans.mkString(" "))
  }
}
