import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Ord

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    bs <- getIntList
    let ga = map (pred . length) . group . sort $ [1..n] ++ as
        gb = map (pred . length) . group . sort $ [1..n] ++ bs
        p = any (> n) $ zipWith (+) ga gb
    let rs = solve ([],[]) as bs
    if p then
        putStrLn "No"
    else do
        putStrLn "Yes"
        putStrLn $ unwords $ map show rs

solve (_,ans) [] [] = reverse ans
solve (l,ans) as [] = solve ([],ans) as l
solve (l,ans) (a:as) (b:bs)
    | a /= b = solve (l,b:ans) as bs
    | a == b = solve (b:l,ans) (a:as) bs
