#include #include #define rep(i,n) for(int i=0;i vi; typedef vector vl; typedef vector> vvi; typedef vector> vvl; typedef long double ld; typedef pair P; template ostream& operator<<(ostream& os, const static_modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const dynamic_modint& a) {os << a.val(); return os;} template istream& operator>>(istream& is, static_modint& a) {long long x; is >> x; a = x; return is;} template istream& operator>>(istream& is, dynamic_modint& a) {long long x; is >> x; a = x; return is;} template istream& operator>>(istream& is, vector& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template ostream& operator<<(ostream& os, const pair& p){os << p.first << ' ' << p.second; return os;} template ostream& operator<<(ostream& os, const vector& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const vector>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} template ostream& operator<<(ostream& os, const set& se){for(T x : se) os << x << " "; os << "\n"; return os;} template ostream& operator<<(ostream& os, const unordered_set& se){for(T x : se) os << x << " "; os << "\n"; return os;} template ostream& operator<<(ostream& os, const atcoder::segtree& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const atcoder::lazy_segtree& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;} template void chmin(T& a, T b){a = min(a, b);} template void chmax(T& a, T b){a = max(a, b);} int main(){ int n, m; cin >> n >> m; vector> G(n); rep(i, m){ int u, v; cin >> u >> v; u--; v--; G[u].insert(v); G[v].insert(u); } vector a(n); cin >> a; int q; cin >> q; const int B = sqrt(m + q); unordered_set major; vector s(n); rep(u, n){ if(int(G[u].size()) >= B){ major.insert(u); }else{ for(int v : G[u]){ s[v] += a[u]; } } } auto update = [&](int u, int c){ if(int(G[u].size()) >= B){ major.insert(u); }else{ major.erase(u); } if(major.find(u) != major.end()){ }else{ for(int v : G[u]){ s[v] += a[u] * c; } } }; rep(i, q){ int t; cin >> t; if(t == 1){ int u, v; cin >> u >> v; u--; v--; if(G[u].find(v) != G[u].end()){ update(u, -1); update(v, -1); G[u].erase(v); G[v].erase(u); update(u, +1); update(v, +1); }else{ update(u, -1); update(v, -1); G[u].insert(v); G[v].insert(u); update(u, +1); update(v, +1); } } if(t == 2){ int u, val; cin >> u >> val; u--; update(u, -1); a[u] = val; update(u, +1); } if(t == 3){ int u; cin >> u; u--; long long ans = s[u]; for(int v : major){ if(G[u].find(v) != G[u].end()){ ans += a[v]; } } cout << ans << "\n"; } } return 0; }