description: 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>
solution: # ///////////////////////////////////////////////////////////////////////////
  # //////////////////// PYTHON IS THE BEST ////////////////////////
  # ///////////////////////////////////////////////////////////////////////////
  import sys,os,io
  from sys import stdin
  import math 
  from collections import defaultdict
  from heapq import heappush, heappop, heapify
  from bisect import bisect_left , bisect_right
  from io import BytesIO, IOBase
  BUFSIZE = 8192
  
  class FastIO(IOBase):
      newlines = 0
  
      def __init__(self, file):
          self._fd = file.fileno()
          self.buffer = BytesIO()
          self.writable = "x" in file.mode or "r" not in file.mode
          self.write = self.buffer.write if self.writable else None
  
      def read(self):
          while True:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              if not b:
                  break
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines = 0
          return self.buffer.read()
  
      def readline(self):
          while self.newlines == 0:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              self.newlines = b.count(b"\n") + (not b)
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines -= 1
          return self.buffer.readline()
  
      def flush(self):
          if self.writable:
              os.write(self._fd, self.buffer.getvalue())
              self.buffer.truncate(0), self.buffer.seek(0)
  
  
  class IOWrapper(IOBase):
      def __init__(self, file):
          self.buffer = FastIO(file)
          self.flush = self.buffer.flush
          self.writable = self.buffer.writable
          self.write = lambda s: self.buffer.write(s.encode("ascii"))
          self.read = lambda: self.buffer.read().decode("ascii")
          self.readline = lambda: self.buffer.readline().decode("ascii")
  
  
  
  
  alphabets = list('abcdefghijklmnopqrstuvwxyz')
  
  
  
  #for deep recursion__________________________________________-
  from types import GeneratorType
  def bootstrap(f, stack=[]):
      def wrappedfunc(*args, **kwargs):
          if stack:
              return f(*args, **kwargs)
          else:
              to = f(*args, **kwargs)
              while True:
                  if type(to) is GeneratorType:
                      stack.append(to)
                      to = next(to)
                  else:
                      stack.pop()
                      if not stack:
                          break
                      to = stack[-1].send(to)
              return to
  
      return wrappedfunc
  
  def ncr(n, r, p):  
      num = den = 1
      for i in range(r):
          num = (num * (n - i)) % p
          den = (den * (i + 1)) % p
      return (num * pow(den,p - 2, p)) % p
  
  def primeFactors(n): 
      l = []
      while n % 2 == 0: 
          l.append(2)
          n = n / 2
      for i in range(3,int(math.sqrt(n))+1,2): 
          while n % i== 0: 
              l.append(int(i))
              n = n / i 
      if n > 2: 
          l.append(n)
      # c = dict(Counter(l))
      return list(set(l))
      # return c
  
  def power(x, y, p) : 
  	res = 1
  	x = x % p 
  	if (x == 0) : 
  		return 0
  	while (y > 0) : 
  		if ((y & 1) == 1) : 
  			res = (res * x) % p 
  		y = y >> 1	 # y = y/2 
  		x = (x * x) % p 		
  	return res 
  
  #____________________GetPrimeFactors in log(n)________________________________________
  def sieveForSmallestPrimeFactor():
      MAXN = 100001
      spf = [0 for i in range(MAXN)]
      spf[1] = 1
      for i in range(2, MAXN):
          spf[i] = i
      for i in range(4, MAXN, 2):
          spf[i] = 2
      for i in range(3, math.ceil(math.sqrt(MAXN))):
          if (spf[i] == i):
              for j in range(i * i, MAXN, i): 
                  if (spf[j] == j):
                      spf[j] = i
      return spf
  def getPrimeFactorizationLOGN(x):
      spf = sieveForSmallestPrimeFactor()
      ret = list()
      while (x != 1):
          ret.append(spf[x])
          x = x // spf[x]  
      return ret
  #____________________________________________________________
  
  
  
  def SieveOfEratosthenes(n): 
      #time complexity = nlog(log(n))
      prime = [True for i in range(n+1)]
      p = 2
      while (p * p <= n):
          if (prime[p] == True):
              for i in range(p * p, n+1, p):
                  prime[i] = False
          p += 1
      return prime
  def si():
      return input()
  def divideCeil(n,x):
      if (n%x==0):
          return n//x
      return n//x+1
  def ii():
      return int(input())
  def li():
      return list(map(int,input().split()))
  
  
  # ///////////////////////////////////////////////////////////////////////////
  # //////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
  # ///////////////////////////////////////////////////////////////////////////
  if(os.path.exists('input.txt')):
      sys.stdin = open("input.txt","r") ; sys.stdout = open("output.txt","w") 
  else:
      sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
      input = lambda: sys.stdin.readline().rstrip("\r\n")
  def isPrime(n):
   
      # Corner case
      if (n <= 1):
          return False
   
      # Check from 2 to n-1
      for i in range(2, n):
          if (n % i == 0):
              return False
   
      return True
   
  n,m = li()
  inbig = [0]*(n+1)
  for i in range(m):
      u,v = li()
      if u>v:
          inbig[v]+=1
      else:
          inbig[u]+=1
  ans = inbig.count(0)-1
  q = ii()
  for i in range(q):
      l = li()
      if len(l)==1:
          print(ans)
          continue
      if l[0]==1:
          u,v = l[1],l[2]
          if u>v:
              inbig[v]+=1
              if inbig[v]==1:
                  ans-=1
          else:
              inbig[u]+=1
              if inbig[u]==1:
                  ans-=1 
      else:
          u,v = l[1],l[2]
          if u>v:
              inbig[v]-=1
              if inbig[v]==0:
                  ans+=1
          else:
              inbig[u]-=1
              if inbig[u]==0:
                  ans+=1
  
  