#include #include using mint = atcoder::static_modint<998244353>; //using mint = atcoder::static_modint<1000000007>; using namespace std; using namespace atcoder; using ld = long double; using ll = long long; #define mp(a,b) make_pair(a,b) #define rep(i,s,n) for(int i=s; i dx{1,0,-1,0},dy{0,1,0,-1}; int main(){ int n,k,l; cin >> n >> k >> l; vector a(k); vector b(l); rep(i,0,k)cin >> a[i]; rep(i,0,l)cin >> b[i]; vector A(n+5); iota(A.begin(),A.end(),0); auto B=A; for(auto x:a)swap(A[x],A[x+1]); for(auto x:b)swap(B[x],B[x+1]); if(A==B)cout << "YES\n"; else cout << "NO\n"; }