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: 
   
   //   * * * the goal is to be worlds best * * *   //
   import java.io.BufferedReader;
   import java.io.IOException;
   import java.io.InputStreamReader;
   import java.util.*;
    
   
   public class C {
       static class Pair implements Comparable<Pair>{
           int a;
           int b;
   
           Pair(int a , int b){
               this.a = a;
               this.b = b;
           }
   
           public int compareTo(Pair o){
               return this.a - o.a;
           }
       }
   
   //==================================================================================================
   
       public static void main(String[] args) {
          FastScanner sc = new FastScanner();
          int t = 1;
          while(t-->0){
              int n = sc.nextInt();
              int m = sc.nextInt();
              // ArrayList<Pair> g[] = new ArrayList[n + 1];
              // for(int i = 1; i < n + 1; i++){
              //     g[i] = new ArrayList<>();
              // }
              HashMap<Integer , HashSet<Integer>> map = new HashMap<>();
              HashSet<Integer> set = new HashSet<>();
              for(int i = 1; i < n + 1; i++){
                  set.add(i);
              }
  
              for(int i = 0; i < m; i++){
                  int u = sc.nextInt();
                  int v = sc.nextInt();
                  int mi = Math.min(u , v);
                  int mx = Math.max(u , v);
  
                  if(!map.containsKey(mi)){
                      map.put(mi , new HashSet<>());
                  }
                  map.get(mi).add(mx);
                  set.remove(mi);
              }
  
              int q = sc.nextInt();
              while(q-->0){
                  int ff = sc.nextInt();
  
                  if(ff == 1){
                      int ss = sc.nextInt();
                      int tt = sc.nextInt();
      
                      int mi = Math.min(ss , tt);
                      int mx = Math.max(ss , tt);
  
                      if(!map.containsKey(mi)){
                          map.put(mi , new HashSet<>());
                      }
                      map.get(mi).add(mx);
                      set.remove(mi);
                  }
                  else if(ff == 2){
                      int ss = sc.nextInt();
                      int tt = sc.nextInt();
      
                      int mi = Math.min(ss , tt);
                      int mx = Math.max(ss , tt);
  
                      if(!map.containsKey(mi)){
                          map.put(mi , new HashSet<>());
                      }
                      // map.get(mi).add(mx);
                      map.get(mi).remove(mx);
                      if(map.get(mi).size() == 0){
                          set.add(mi);
                      }
                  }
                  else if(ff == 3){
                      System.out.println(set.size());
                  }
              }
  
          }
       }
   
   //==================================================================================================
   
   
       // Use this instead of Arrays.sort() on an array of ints. Arrays.sort() is n^2
       // worst case since it uses a version of quicksort. Although this would never
       // actually show up in the real world, in codeforces, people can hack, so
       // this is needed. 
  	 static void sort(int[] arr) {
  		 int n = arr.length;
  		 ArrayList<Integer> res = new ArrayList<>();
  		 for (int a : arr) {
  		 	 res.add(a);
  		 }
  		 Collections.sort(res);
  		 for (int i = 0; i < n; i++) {
  			 arr[i] = res.get(i);
  		 }
  	 }
   
  	 static void sort(long[] arr) {
  		 int n = arr.length;
  		 ArrayList<Long> res = new ArrayList<>();
  		 for (long a : arr) {
  			 res.add(a);
  		 }
  		 Collections.sort(res);
  		 for (int i = 0; i < n; i++) {
  			 arr[i] = res.get(i);
  		} 
  	 }
   
  	 static void revSort(int[] arr) {
  		 int n = arr.length;
  		 ArrayList<Integer> res = new ArrayList<>();
  		 for (int a : arr) {
  			 res.add(a);
  		 }
  		 Collections.sort(res, Collections.reverseOrder());
  		 for (int i = 0; i < n; i++) {
  			 arr[i] = res.get(i);
  		 }
  	 } 
       
       // Use this to input code since it is faster than a Scanner
       static class FastScanner {
           BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
           StringTokenizer st=new StringTokenizer("");
           String next() {
               while (!st.hasMoreTokens())
                   try {
                       st=new StringTokenizer(br.readLine());
                   } catch (IOException e) {
                       e.printStackTrace();
                   }
               return st.nextToken();
           }
           
           int nextInt() {
               return Integer.parseInt(next());
           }
   
           double nextDouble() {
               return Double.parseDouble(next());
           }
    
           String str = "";
    
           String nextLine() {
               try {
                   str = br.readLine();
               } catch (IOException e) {
                   e.printStackTrace();
               }
               return str;
           }
    
           int[] readArray(int n) {
               int[] a = new int[n];
               for (int i = 0; i < n; i++)
                   a[i] = nextInt();
               return a;
           }
    
           long[] readLongArray(int n) {
               long[] a = new long[n];
               for (int i = 0; i < n; i++)
                   a[i] = nextLong();
               return a;
           }
           long nextLong() {
               return Long.parseLong(next());
           }
       }
       
       // print integers in array
       static void print(int a[]){
           for(int e : a){
               System.out.print(e + " ");
           }
           System.out.println();
       }
  
       static void print(long a[]){
           for(long e : a){
               System.out.print(e + " ");
           }
           System.out.println();
       }
  
       // generates all the prime numbers upto n
       static void sieveOfEratosthenes(int n , ArrayList<Integer> al)
       {
           boolean prime[] = new boolean[n + 1];
           for (int i = 0; i <= n; i++)
               prime[i] = true;
    
           for (int p = 2; p * p <= n; p++) 
           {
               if (prime[p] == true) 
               {
                   for (int i = p * p; i <= n; i += p)
                       prime[i] = false;
               }
           }
           for (int i = 2; i <= n; i++)
           {
               if (prime[i] == true)
                   al.add(i);
           }
       }
       static final int mod = 1000_000_000 + 7;
       static final int imx = Integer.MAX_VALUE;
       static final int imi = Integer.MIN_VALUE;
       
  	 static ArrayList<Integer> divisors(int n) {
  		 ArrayList<Integer> al = new ArrayList<>();
  		 for (int i = 1; i * i <= n; i++) {
  			 if (n % i == 0) {
  				 if (n == i * i) {
  					 al.add(i);
  				 } else {
  					 al.add(i);
  					 al.add(n / i);
  				 }
  		 	 }
  		 }
  		 Collections.sort(al);
  		 return al;
  	 }
   
  	 static int countDigits(int n) {
  		 int c = 0;
  		 while (n != 0) {
  			 c++;
  			 n /= 10;
  		 }
  		 return c;
  	 }
   
  	 static boolean palindrome(String str) {
  		 int s = 0;
  		 int e = str.length() - 1;
  		 while (s < e) {
  			 if (str.charAt(s) != str.charAt(e)) {
  				 return false;
  			 }
  			 s++;
  			 e--;
  		 }
  		 return true;
  	 }
   
  	 static void reverse(int[] arr, int s, int e) {
  		 while (s < e) {
  			 int temp = arr[s];
  			 arr[s++] = arr[e];
  			 arr[e--] = temp;
  		 }
  	 }
       // starting exclusive ending inclusive
  	 static int getMax(int[] arr, int s, int e) {
  		 int maxi = s;
  		 for (int i = s + 1; i <= e; i++) {
  			 if (arr[i] > arr[maxi]) {
  				 maxi = i;
  			 }
  		 }
  		 return maxi;
  	 }
  
       // starting exclusive ending inclusive
       static int getMin(int[] arr, int s, int e) {
  	     int mini = s;
  		 for (int i = s + 1; i <= e; i++) {
  			 if (arr[i] < arr[mini]) {
  				 mini = i;
  			 }
  		 }
  		 return mini;
  	 }
   
  	 static long lcm(long n1, long n2) {
  		 return (n1 * n2) / gcd(n1, n2);
   	 }
   
  	 static int lcm(int n1, int n2) {
  		 return (n1 * n2) / gcd(n1, n2);
  	 }
   
  	 static long gcd(long num1, long num2) {
  		 if (num2 == 0) {
  			 return num1;
  		 }
  		 return gcd(num2, num1 % num2);
  	 }
   
  	 static int gcd(int num1, int num2) {
  		 if (num2 == 0) {
  			 return num1;
  		 }
  		 return gcd(num2, num1 % num2);
  	 }
  
       //fastPow
       static long fastPow(long base, long exp) {
           if (exp==0) return 1;
           long half=fastPow(base, exp/2);
           if (exp%2==0) return mul(half, half);
           return mul(half, mul(half, base));
       }
   
       // multiply two long numbers % mod
       static long mul(long a, long b) {
           return a*b%mod;
       }
   
       static int nCr(int n, int r)
       {
          return factorial(n) / (factorial(r) *
              factorial(n - r));
       }
       
       // Returns factorial of n
       static int factorial(int n)
       {
           int res = 1;
           for (int i = 2; i <= n; i++)
               res = res * i;
           return res;
       }
        
       // to generate the lps array
       // lps means longest preffix that is also a suffix
       static void generateLPS(int lps[] , String p){
           int l = 0;
           int r = 1;
      
           while(l < p.length() && l < r && r < p.length()){
               if(p.charAt(l) == p.charAt(r)){
                   lps[r] = l + 1;
                   l++;
                   r++;
               }
               else{
                   if(l > 0)
                       l = lps[l - 1];
                   else
                       r++;    
               }
           }
       }
        
       // returns the index of the element which is just smaller than or
       // equal to the tar in the given arraylist 
       static int lowBound(ArrayList<Integer> ll,long tar ,int l,int r){
           if(l>r) return l;
   
           int mid=l+(r-l)/2;
   
           if(ll.get(mid)>=tar){
               return lowBound(ll,tar,l,mid-1);
           }
   
           return lowBound(ll,tar,mid+1,r);
       }
   
       // returns the index of the element which is just greater than or
       // equal to the tar in the given arraylist 
       static int upBound(ArrayList<Integer> ll,long tar,int l ,int r){
           if(l>r) return l;
   
           int mid=l+(r-l)/2;
   
           if(ll.get(mid)<=tar){
               return upBound(ll,tar,mid+1 ,r);
           }
   
           return upBound(ll,tar,l,mid-1);
       }
   
       static void swap(int a[] , int i , int j){
           int x = a[i];
           int y = a[j];
           a[j] = x;
           a[i] = y;
       }
       static void swap(long a[] , int i , int j){
           long x = a[i];
           long y = a[j];
           a[j] = x;
           a[i] = y;
      }
       // a -> z == 97 -> 122
   
       // String.format("%.9f", ans) ,--> to get upto 9 decimal places , (ans is double)
       
       // write 
   }
   