Scanf.scanf "%d" (fun n ->
    let a = Array.make (n + 1) 0 in
    let b = Array.make (n + 1) 0 in
    let bb = Array.make n 0 in
    let module S = Set.Make (struct type t = int * int let compare = compare end) in
    for i = 1 to n do Scanf.scanf " %d" (fun j -> a.(j) <- a.(j) + 1) done;
    for i = 1 to n do Scanf.scanf " %d" (fun j -> b.(j) <- b.(j) + 1; bb.(i - 1) <- j) done;

    let rec check i =
        if i > n then true else if a.(i) + b.(i) > n then false else check (i + 1)
    in
    if check 1 then (
        let c = Array.make (n + 1) 0 in
        let d = Array.make (n + 1) 0 in
        for i = 1 to n do
            c.(i) <- c.(i - 1) + a.(i);
            d.(i) <- d.(i - 1) + b.(i);
        done;
        let rec loop i mx =
            if i > n then mx else loop (i + 1) (max mx (c.(i) - d.(i - 1)))
        in
        let x = loop 1 0 in
        print_endline "Yes";
        for i = 0 to n - 1 do
            Printf.printf "%d " bb.((i - x + n) mod n)
        done;
        print_newline ()
    ) else print_endline "No"
)