#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
// #include <atcoder/all>
// #include "icld.cpp"
using namespace std;
using ll = long long int;
using vi = vector<int>;
using si = set<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using ss = string;
using db = double;
template<typename T> using minpq = priority_queue <T,vector<T>,greater<T>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
#define V vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define rep(i,s,n) for(int i=(s);i<(int)(n);i++)
#define rev(i,s,n) for(int i=(s);i>=(int)(n);i--)
#define reciv(v,n) vi (v)((n)); rep(i,0,(n))cin>>v[i]
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ci(x) cin >> x
#define cii(x) ll x;cin >> x
#define cci(x,y) ll x,y;cin >> x >> y
#define co(x) cout << x << endl
#define pb push_back
#define eb emplace_back
#define rz resize
#define sz(x) int(x.size())
#define yn cout<<"Yes"<<endl;else cout<<"No"<<endl
#define YN cout<<"YES"<<endl;else cout<<"NO"<<endl
template<class T>void chmax(T &x,T y){x=max(x,y);}
template<class T>void chmin(T &x,T y){x=min(x,y);}
// segment tree
vector<int> seg_t;int seg_sz=1;
int seg_func_init(int l,int r){return 
/*関数書換*/    l^r;}
int seg_content(int i){return seg_t[seg_sz+i-1];}
void seg_sz_init(int vec_sz,int init_num){while(seg_sz<vec_sz)seg_sz<<= 1;seg_t.resize(seg_sz*2-1,init_num);}
void seg_init(int index,int x){ int now = index+seg_sz-1;seg_t[now] = x;
    while(now){int par=(now-1)/2; int chi=par*2+1; if(now==chi)chi++;seg_t[par]=seg_func_init(seg_t[now],seg_t[chi]);now=par;}}
int seg_func(int a,int b,int now=0,int l=0,int r=seg_sz){if(a<=l && r<=b)return seg_t[now];if(r<=a || b<=l)return 0;
    int hf=(l+r)/2;int chi_l=seg_func(a,b,now*2+1,l,hf);int chi_r=seg_func(a,b,now*2+2,hf,r);return seg_func_init(chi_l,chi_r);}

int main(){
    cci(n,q);
    reciv(v,n);
    seg_sz_init(n,0);

    rep(i,0,n)seg_init(i,v[i]);
    vi ans;

    rep(i,0,q){
        cii(t);
        cci(x,y);
        x--;

        if(t==1){
            int now=seg_content(x);
            seg_init(x,now^y);
        }
        else {
            ans.pb(seg_func(x,y));
        }
    }    

    for(int ret:ans)co(ret);
}
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

vs64 a, b;
vector< vs32 > g;
vector< bool > reached;

bool dfs(int u, s64& suma, s64& sumb)
{
    bool ret = true;
    reached[u] = true;
    suma += a[u];
    sumb += b[u];
    for (auto& v : g[u])
    {
        if (!reached[v])
        {
            ret = dfs(v, suma, sumb);          
        }
    }
    return suma == sumb;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    a.resize(n), b.resize(n);
    rep (i, n) cin >> a[i];
    rep (i, n) cin >> b[i];

    g.resize(n);
    reached.resize(n, false);
    rep (i, m)
    {
        int u, v;
        cin >> u >> v;
        --u, --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    bool ans = true;
    s64 suma, sumb;
    rep (i, n)
    {
        if (!reached[i])
        {
            suma = 0; sumb = 0;
            ans &= dfs(i, suma, sumb);
        }
    }

    cout << (ans ? "Yes\n" : "No\n");
    return 0;
}

