#include <bits/stdc++.h>
using namespace std;
template<typename T, typename U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<typename T, typename U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }

// DEBUG BEGIN
#ifdef LOCAL
template<typename L, typename R> ostream &operator<<(ostream &out, const pair<L, R> &p){
	return out << "(" << p.first << ", " << p.second << ")";
}
template<typename Tuple, size_t N> struct TuplePrinter{
	static ostream &print(ostream &out, const Tuple &t){ return TuplePrinter<Tuple, N-1>::print(out, t) << ", " << get<N-1>(t); }
};
template<typename Tuple> struct TuplePrinter<Tuple, 1>{
	static ostream &print(ostream &out, const Tuple& t){ return out << get<0>(t); }
};
template<typename... Args> ostream &print_tuple(ostream &out, const tuple<Args...> &t){
	return TuplePrinter<decltype(t), sizeof...(Args)>::print(out << "(", t) << ")";
}
template<typename ...Args> ostream &operator<<(ostream &out, const tuple<Args...> &t){
	return print_tuple(out, t);
}
template<typename T> ostream &operator<<(enable_if_t<!is_same<T, string>::value, ostream> &out, const T &arr){
	out << "{"; for(auto &x: arr) out << x << ", ";
	return out << (arr.size() ? "\b\b" : "") << "}";
}
template<size_t S> ostream &operator<<(ostream &out, const bitset<S> &b){
	for(int i = 0; i < S; ++ i) out << b[i];
	return out;
}
void debug_out(){ cerr << "\b\b " << endl; }
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){ cerr << H << ", ", debug_out(T...); }
void debug2_out(){ cerr << "-----DEBUG END-----\n"; }
template<typename Head, typename... Tail>
void debug2_out(Head H, Tail... T){ cerr << "\n"; for(auto x: H) cerr << x << "\n"; debug2_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#define debug2(...) cerr << "----DEBUG BEGIN----\n[" << #__VA_ARGS__ << "]:", debug2_out(__VA_ARGS__)
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// DEBUG END

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int n;
	cin >> n;
	const int inf = numeric_limits<int>::max();
	vector<int> a(n), b(n);
	vector<int> al(n + 1, -1), ar(n + 1, -1), bl(n + 1, -1), br(n + 1, -1);
	for(auto i = 0; i < n; ++ i){
		cin >> a[i];
	}
	for(auto i = 0; i < n; ++ i){
		cin >> b[i];
	}
	int tot = 0;
	vector<int> cnt(n + 1);
	for(auto x = 1, ai = 0, bi = 0; x <= n; ++ x){
		while(ai < n && a[ai] < x){
			++ ai;
		}
		if(ai < n && a[ai] == x){
			int aj = ai;
			while(aj < n && a[aj] == x){
				++ aj;
			}
			tie(al[x], ar[x]) = pair{ai, aj};
			ai = aj;
		}
		while(bi < n && b[bi] < x){
			++ bi;
		}
		if(bi < n && b[bi] == x){
			int bj = bi;
			while(bj < n && b[bj] == x){
				++ bj;
			}
			tie(bl[x], br[x]) = pair{bi, bj};
			bi = bj;
		}
		if(~al[x] && ~bl[x]){
			++ tot;
			debug(x, al[x], ar[x], bl[x], br[x]);
			if(ar[x] - al[x] + br[x] - bl[x] > n){
				cout << "No\n";
				return 0;
			}
			if(bl[x] <= al[x]){
				if(br[x] <= al[x]){
					debug(0, al[x] - br[x] + 1);
					++ cnt[0];
					-- cnt[al[x] - br[x] + 1];
					debug(ar[x] - bl[x], n);
					++ cnt[ar[x] - bl[x]];
					-- cnt[n];
				}
				else{
					++ cnt[ar[x] - bl[x]];
					-- cnt[al[x] + n - br[x] + 1];
					debug(ar[x] - bl[x], al[x] + n - br[x] + 1);
				}
			}
			else{
				++ cnt[max(0, ar[x] - bl[x])];
				-- cnt[al[x] + n - br[x] + 1];
				debug(max(0,ar[x] - bl[x]), al[x] + n - br[x] + 1);
			}
		}
	}
	for(auto t = 0; t < n; ++ t){
		if(cnt[t] == tot){
			debug(t);
			cout << "Yes\n";
			rotate(b.begin(), b.begin() + n - t, b.end());
			for(auto x: b){
				cout << x << " ";
			}
			cout << "\n";
			return 0;
		}
		cnt[t + 1] += cnt[t];
	}
	cout << "No\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 8736