program contrast
  implicit none
  integer :: n, m = 0, i
  integer, allocatable :: a(:), b(:), c(:), d(:)
  read(*,*) n
  allocate(a(n), b(n), c(0:n), d(0:n))
  read(*,*) a
  read(*,*) b
  do i = 1, n
    c(a(i)) = c(a(i)) + 1
    d(b(i)) = d(b(i)) + 1
  end do
  if (any(c + d > n)) then
    write(*,'(a)') 'No'
    stop
  end if
  do i = 1, n
    c(i) = c(i) + c(i - 1)
    d(i) = d(i) + d(i - 1)
    m = max(m, c(i) - d(i - 1))
  end do
  m = n - m
  write(*,'(a)') 'Yes'
  write(*,'(i0)',advance='no') b(merge(m + 1 - n, m + 1, m + 1 > n))
  do i = 2, n
    write(*,'(x,i0)',advance='no') b(merge(m + i - n, m + i, m + i > n))
  end do
  write(*,*)
end program contrast