human
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...
Solve the task in PYTHON3.

Can you provide a Python program to print the answer to the process described in the statement?
assistant
#Here is Python program to print the answer to the process described in the statement.

import sys
from sys import stdout

input = lambda: sys.stdin.readline().strip()
P = lambda: list(map(int, input().split()))
from math import factorial as f, gcd, ceil
from collections import deque, defaultdict as dd, Counter as C
from heapq import heapify, heappop, heappush, heappushpop, heapreplace, merge
from random import randint, choice, sample
import time
mod = 10**9+7
a = ord('a')

# Fenwick Tree
class FT:
    def __init__(self, N):
        self.ft = [0] * (N+1)
        self.N = N

    def ls(self, x):
        return x & -x

    def fenwick_update(self, p, v):
        while p <= self.N:
            self.ft[p] += v
            p += self.ls(p)

    def fenwick_query(self, p):
        s = 0
        while p:
            s += self.ft[p]
            p -= self.ls(p)
        # print(p, s)
        return s

start = time.time()
def fast_exp(x, exp):
    ans = 1
    base = x
    while exp:
        if exp & 1:
            ans *= base
        base *= base
        base %= mod
        ans %= mod
        exp >>= 1
    return ans

def countBits(n):
    count = 0
    while n:
        count += n & 1
        n >>= 1
    return count

def submasks(n):
    #this is cool
    #https://cp-algorithms.com/algebra/all-submasks.html
    org = n
    while n:
        yield n
        n = (n-1) & org

def solve():
    n, m = P()
    arr = [0] * (n+1)
    die = 0
    for _ in range(m):
        u, v = P()
        if v < u:
            u, v = v, u
        arr[u] += 1
        if arr[u] == 1:
            die += 1

    q = int(input())
    for _ in range(q):
        que = P()
        if que[0] == 1:
            u, v = que[1:]
            if v < u:
                u, v = v, u
            arr[u] += 1
            if arr[u] == 1:
                die += 1
        elif que[0] == 2:
            u, v = que[1:]
            if v < u:
                u, v = v, u
            arr[u] -= 1
            if arr[u] == 0:
                die -= 1
        else:
            print(n - die)

            

            


# tc = int(input())
# for t in range(1,...