#include <bits/stdc++.h>
const long long N = 3 * 1e5 + 5;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;
using namespace std;
vector<long long> s, x, y;
long long modpow(long long x, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
void precompute() {}
template <typename T>
bool compare(const T &a, const T &b) {
  return a.first < b.first;
}
vector<long long> bit;
void add(long long idx, long long delta, long long n) {
  for (; idx < n; idx = idx | (idx + 1)) bit[idx] += delta;
}
long long sum(long long r) {
  long long ret = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) ret += bit[r];
  return ret;
}
long long sum(long long l, long long r) { return sum(r) - sum(l - 1); }
int isbig(set<int> &second, long long i) {
  if (second.size() == 0) return 1;
  auto it = second.end();
  it--;
  if (*it < i) return 1;
  return 0;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  set<int> s[n];
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    s[a].insert(b);
    s[b].insert(a);
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += isbig(s[i], i);
  }
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long val;
    cin >> val;
    if (val == 1) {
      long long u, v;
      cin >> u >> v;
      u--;
      v--;
      ans -= isbig(s[u], u);
      ans -= isbig(s[v], v);
      s[u].insert(v);
      s[v].insert(u);
      ans += isbig(s[u], u);
      ans += isbig(s[v], v);
    } else if (val == 2) {
      long long u, v;
      cin >> u >> v;
      u--;
      v--;
      ans -= isbig(s[u], u);
      ans -= isbig(s[v], v);
      s[u].erase(v);
      s[v].erase(u);
      ans += isbig(s[u], u);
      ans += isbig(s[v], v);
    } else if (val == 3) {
      cout << ans << "\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long t = 1;
  precompute();
  long long ctr = 0;
  while (t--) {
    ctr++;
    solve();
    cout << "\n";
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}

### Prompt

Please provide a CPP coded solution to the problem described below:

When you play the game of thrones, you win, or you die. There is no middle ground.

Cersei Lannister, A Game of Thrones by George R. R. Martin

There are n nobles, numbered from 1 to n. Noble i has a power of i. There are also m "friendships". A friendship between nobles a and b is always mutual.

A noble is defined to be vulnerable if both of the following conditions are satisfied: 

  * the noble has at least one friend, and 
  * all of that noble's friends have a higher power. 



You will have to process the following three types of queries. 

  1. Add a friendship between nobles u and v. 
  2. Remove a friendship between nobles u and v. 
  3. Calculate the answer to the following process. 



The process: all vulnerable nobles are simultaneously killed, and all their friendships end. Then, it is possible that new nobles become vulnerable. The process repeats itself until no nobles are vulnerable. It can be proven that the process will end in finite time. After the process is complete, you need to calculate the number of remaining nobles.

Note that the results of the process are not carried over between queries, that is, every process starts with all nobles being alive!

Input

The first line contains the integers n and m (1 ≤ n ≤ 2⋅ 10^5, 0 ≤ m ≤ 2⋅ 10^5) — the number of nobles and number of original friendships respectively.

The next m lines each contain the integers u and v (1 ≤ u,v ≤ n, u ≠ v), describing a friendship. No friendship is listed twice.

The next line contains the integer q (1 ≤ q ≤ 2⋅ {10}^{5}) — the number of queries. 

The next q lines contain the queries themselves, each query has one of the following three formats. 

  * 1 u v (1 ≤ u,v ≤ n, u ≠ v) — add a friendship between u and v. It is guaranteed that u and v are not friends at this moment. 
  * 2 u v (1 ≤ u,v ≤ n, u ≠ v) — remove a friendship between u and v. It is guaranteed that u and v are friends at this moment. 
  * 3 — print the answer to the process described in the statement. 

Output

For each type 3 query print one integer to a new line. It is guaranteed that there will be at least one type 3 query.

Examples

Input


4 3
2 1
1 3
3 4
4
3
1 2 3
2 3 1
3


Output


2
1


Input


4 3
2 3
3 4
4 1
1
3


Output


1

Note

Consider the first example. In the first type 3 query, we have the diagram below.

In the first round of the process, noble 1 is weaker than all of his friends (2 and 3), and is thus killed. No other noble is vulnerable in round 1. In round 2, noble 3 is weaker than his only friend, noble 4, and is therefore killed. At this point, the process ends, and the answer is 2.

<image>

In the second type 3 query, the only surviving noble is 4.

The second example consists of only one type 3 query. In the first round, two nobles are killed, and in the second round, one noble is killed. The final answer is 1, since only one noble survives.

<image>

### Response

```cpp
#include <bits/stdc++.h>
const long long N = 3 * 1e5 + 5;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;
using namespace std;
vector<long long> s, x, y;
long long modpow(long long x, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
void precompute() {}
template <typename T>
bool compare(const T &a, const T &b) {
  return a.first < b.first;
}
vector<long long> bit;
void add(long long idx, long long delta, long long n) {
  for (; idx < n; idx = idx | (idx + 1)) bit[idx] += delta;
}
long long sum(long long r) {
  long long ret = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) ret += bit[r];
  return ret;
}
long long sum(long long l, long long r) { return sum(r) - sum(l - 1); }
int isbig(set<int> &second, long long i) {
  if (second.size() == 0) return 1;
  auto it = second.end();
  it--;
  if (*it < i) return 1;
  return 0;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  set<int> s[n];
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    s[a].insert(b);
    s[b].insert(a);
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += isbig(s[i], i);
  }
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long val;
    cin >> val;
    if (val == 1) {
      long long u, v;
      cin >> u >> v;
      u--;
      v--;
      ans -= isbig(s[u], u);
      ans -= isbig(s[v], v);
      s[u].insert(v);
      s[v].insert(u);
      ans += isbig(s[u], u);
      ans += isbig(s[v], v);
    } else if (val == 2) {
      long long u, v;
      cin >> u >> v;
      u--;
      v--;
      ans -= isbig(s[u], u);
      ans -= isbig(s[v], v);
      s[u].erase(v);
      s[v].erase(u);
      ans += isbig(s[u], u);
      ans += isbig(s[v], v);
    } else if (val == 3) {
      cout << ans << "\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long t = 1;
  precompute();
  long long ctr = 0;
  while (t--) {
    ctr++;
    solve();
    cout << "\n";
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}

```