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: // package com.company;
  import java.util.*;
  import java.io.*;
  import java.lang.*;
  public class Main{
      /* || श्री गणेशाय नमः ||
         @𝐚𝐮𝐭𝐡𝐨𝐫 𝐉𝐢𝐠𝐚𝐫 𝐍𝐚𝐢𝐧𝐮𝐣𝐢
         𝐒𝐕𝐍𝐈𝐓- 𝐒𝐮𝐫𝐚𝐭
      */
      public static void main(String args[]){
          InputReader in=new InputReader(System.in);
          TASK solver = new TASK();
          int t=1;
  //        t = in.nextInt();
          for(int i=1;i<=t;i++)
          {
              solver.solve(in,i);
          }
      }
      static class TASK {
          static void buildTree(long arr[],long st[],int start,int end,int treenode) {
              if(start==end) {
                  st[treenode] = arr[start];
                  return;
              }
              int mid = (start+end)/2;
              buildTree(arr,st,start,mid,treenode*2);
              buildTree(arr,st,mid+1,end,treenode*2+1);
              st[treenode]=Maths.gcd(st[2*treenode],st[treenode*2+1]);
              return;
          }
  
          static long query(long st[],int start,int end,int left,int right,int treenode){
              if(start>right || end<left)
                  return -1;
              if(start>=left && end<=right)
                  return st[treenode];
              int mid=(start+end)/2;
              long ans1=query(st,start,mid,left,right,treenode*2);
              long ans2=query(st,mid+1,end,left,right,treenode*2+1);
              if(ans1==-1)
                  return ans2;
              if(ans2==-1)
                  return ans1;
              return Maths.gcd(ans1,ans2);
          }
          static void updateTree(long st[],int start,int end,int idx,long value,int treenode){
              if(start==end){
                  st[treenode]=value;
                  return;
              }
              int mid=(start+end)/2;
              if(idx>mid)
                  updateTree(st,mid+1,end,idx,value,treenode*2+1);
              else
                  updateTree(st,start,mid,idx,value,treenode*2);
              if(st[treenode*2+1]==-1)
                  st[treenode]=st[treenode*2];
              else if(st[treenode*2]==-1)
                  st[treenode]=st[treenode*2+1];
              else
                  st[treenode]=Maths.gcd(st[2*treenode+1],st[2*treenode]);
              return;
          }
  
          void solve(InputReader in, int testNumber) {
              int n = in.nextInt();
              int big[] = new int[n+1];
              int m = in.nextInt();
              int cnt=n;
              Set<String> s = new HashSet<>();
              for(int i=0;i<m;i++)
              {
                  int x = in.nextInt();
                  int y = in.nextInt();
                  if(s.contains(x+" "+y)|| s.contains(y+" "+x))
                  {
                      if (x > y) {
                          if (big[y] == 1)
                              cnt++;
                          big[y]--;
                      } else {
                          if (big[x] == 1)
                              cnt++;
                          big[x]--;
                      }
                      s.remove(x+" "+y);
                      s.remove(y+" "+x);
                  }
                  else {
                      if (x > y) {
                          if (big[y] == 0)
                              cnt--;
                          big[y]++;
                      } else {
                          if (big[x] == 0)
                              cnt--;
                          big[x]++;
                      }
                      s.add(x+" "+y);
                      s.add(y+" "+x);
                  }
              }
              int q = in.nextInt();
              while (q-->0)
              {
                  int c = in.nextInt();
                  if(c==1)
                  {
                      int x = in.nextInt();
                      int y = in.nextInt();
                      if(x>y)
                      {
                          if(big[y]==0)
                              cnt--;
                          big[y]++;
                      }
                      else
                      {
                          if(big[x]==0)
                              cnt--;
                          big[x]++;
                      }
                  }
                  else if(c==2)
                  {
                      int x = in.nextInt();
                      int y = in.nextInt();
                      if(x>y)
                      {
                          if(big[y]==1)
                              cnt++;
                          big[y]--;
                      }
                      else
                      {
                          if(big[x]==1)
                              cnt++;
                          big[x]--;
                      }
                  }
                  else
                  {
                      System.out.println(cnt);
                  }
  
              }
  
  
  
  
  
  
  
  
  
  
  
  
          }
      }
  
  
      static class pair{
          int x ;
          int y;
          pair(int x,int y)
          {
              this.x=x;
              this.y=y;
          }
      }
  
      static class Maths {
          static long gcd(long a, long b) {
              if (a < b)
                  return gcd(b,a);
              if (b == 0)
                  return a;
              else
                  return gcd(b,a%b);
          }
          public static long lcm(long a, long b) {
              return (a * b) / gcd(a, b);
          }
  
      }
      static class InputReader {
          private InputStream stream;
          private byte[] buf = new byte[1024];
          private int curChar;
          private int numChars;
          private SpaceCharFilter filter;
          public InputReader(InputStream stream) {
              this.stream = stream;
          }
          public int read() {
              if (numChars == -1)
                  throw new InputMismatchException();
              if (curChar >= numChars) {
                  curChar = 0;
                  try {
                      numChars = stream.read(buf);
                  } catch (IOException e) {
                      throw new InputMismatchException();
                  }
                  if (numChars <= 0)
                      return -1;
              }
              return buf[curChar++];
          }
          public String nextLine() {
              BufferedReader br = new BufferedReader(new
                      InputStreamReader(System.in));
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
          public int nextInt() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              int res = 0;
              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              while (!isSpaceChar(c));
              return res * sgn;
          }
          public long nextLong() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              long res = 0;
              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              while (!isSpaceChar(c));
              return res * sgn;
          }
          public double nextDouble() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              double res = 0;
              while (!isSpaceChar(c) && c != '.') {
                  if (c == 'e' || c == 'E')
                      return res * Math.pow(10, nextInt());
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              if (c == '.') {
                  c = read();
                  double m = 1;
                  while (!isSpaceChar(c)) {
                      if (c == 'e' || c == 'E')
                          return res * Math.pow(10, nextInt());
                      if (c < '0' || c > '9')
                          throw new InputMismatchException();
                      m /= 10;
                      res += (c - '0') * m;
                      c = read();
                  }
              }
              return res * sgn;
          }
          public String readString() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              StringBuilder res = new StringBuilder();
              do {
                  res.appendCodePoint(c);
                  c = read();
              }
              while (!isSpaceChar(c));
              return res.toString();
          }
          public boolean isSpaceChar(int c) {
              if (filter != null)
                  return filter.isSpaceChar(c);
              return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c
                      == -1;
          }
          public String next() {
              return readString();
          }
          public interface SpaceCharFilter {
              public boolean isSpaceChar(int ch);
          }
      }
  }
  
  