import scala.collection.mutable.Map

object Main extends App {
  val sc = new FastScanner(System.in)
  val n = sc.nextInt()
  val a, b = Array.fill(n)(sc.nextInt() - 1)
  val count = Array.fill(n)(0)
  val idxa = Map[Int, List[Int]]().withDefaultValue(Nil)
  val idxb = Map[Int, List[Int]]().withDefaultValue(Nil)

  for (i <- 0 until n) {
    count(a(i)) += 1
    count(b(i)) += 1
    idxa(a(i)) ::= i
    idxb(b(i)) ::= 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 idxap = idxa(p)
      val idxbq = idxb(q)
      ans(idxap.head) = q + 1

      if (idxap.tail.isEmpty) {
        idxa -= p
      } else {
        idxa(p) = idxap.tail
      }

      if (idxbq.tail.isEmpty) {
        idxb -= q
      } else {
        idxb(q) = idxbq.tail
      }

      val cp = count(p)
      val cq = count(q)
      count(p) -= 1
      count(q) -= 1

      x(cp) -= p
      x(cq) -= q
      x(cp - 1) += p
      x(cq - 1) += 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).toList match {
        case Nil =>
          p = getAny(idxa, -1)
          q = getAny(idxb, p)
        case x1 :: Nil =>
          if (idxa.isDefinedAt(x1)) {
            p = x1
            q = getAny(idxb, p)
          } else {
            q = x1
            p = getAny(idxa, q)
          }
        case x1 :: x2 :: Nil =>
          if (idxa.isDefinedAt(x1)) {
            p = x1
            q = x2
          } else {
            p = x2
            q = x1
          }
      }
      update(p, q)
    }

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

class FastScanner(source: java.io.InputStream) {
  val buf = new Array[Byte](1024)
  var now, end = 0

  def isPrintable(b: Byte): Boolean = 33 <= b && b <= 126
  def isNum(b: Byte): Boolean = 48 <= b && b <= 57

  def hasNextByte: Boolean = {
    if (now < end) {
      true
    } else {
      now = 0
      end = source.read(buf)
      end > 0
    }
  }

  def nextByte(): Byte = {
    if (hasNextByte) {
      val b = buf(now)
      now += 1
      b
    } else {
      -1
    }
  }

  def hasNext: Boolean = {
    while (hasNextByte && !isPrintable(buf(now))) {
      now += 1
    }
    hasNextByte
  }

  def next(): String = {
    if (hasNext) {
      val sb = new StringBuilder()
      var b = nextByte()
      while (isPrintable(b)) {
        sb += b.toChar
        b = nextByte()
      }
      sb.toString
    } else {
      throw new NoSuchElementException()
    }
  }

  def nextInt(): Int = {
    nextLong().toInt
  }

  def nextLong(): Long = {
    if (hasNext) {
      var b = nextByte()
      var sign = 1
      var n = 0L
      if (b == '-') {
        sign = -1
        b = nextByte()
      }
      while (isNum(b)) {
        n = n * 10 + (b - 48)
        b = nextByte()
      }
      sign * n
    } else {
      throw new NoSuchElementException()
    }
  }

  def nextDouble(): Double = next().toDouble
}
