object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val n = readLine.trim.toInt
  val from = readLine.trim.split(' ').map(_.toInt)
  val to = readLine.trim.split(' ').map(_.toInt)
  val fromSet = new Set(from)
  val toSet = new Set(to)
  val (fromA, fromB) = from.sorted.let{a ⇒ (a.head, a(a.length - 1))}
  if (toSet.size == 1 || from.forall(f ⇒ toSet.contains(f))) {
    println("Yes")
  }else {
    println("No")
    println(
      from.indices.map(_ ⇒ fromA).mkString(" ")
    )
    println(
      from.indices.map{
        case i if toSet.contains(from(i)) ⇒ fromA
        case _ ⇒ fromB
      }.mkString(" ")
    )
  }

  class Set[T](factors: Array[T])(implicit ordering: Ordering[T]) {
    private val mList: Array[T] = factors.distinct.sorted
    def contains(value:T): Boolean = {
      lowerBound(mList, value) match {
        case Some(i) ⇒ mList(i) == value
        case None ⇒ false
      }
    }
    def size: Int = mList.size


  }
  def lowerBound[T](array: Array[T], target: T)(implicit ordering: Ordering[T]): Option[Int] = {
    var left = 0
    var right = array.length
    while (left < right){
      val mid = (left + right) / 2
      if (ordering.compare(array(mid), target) < 0){
        left = mid + 1
      }else {
        right = mid
      }
    }
    if (right == array.length) None
    else Some(right)
  }


  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
