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: import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.HashMap;
  import java.util.Random;
  import java.util.StringTokenizer;
  
  public class B{
  // author: Tarun Verma
  static FastScanner sc = new FastScanner();
  static int inf = Integer.MAX_VALUE;
  static long mod = 1000000007;
  
  static boolean isPalindrom(char[] arr, int i, int j) {
  	boolean ok = true;
  	while (i <= j) {
  		if (arr[i] != arr[j]) {
  			ok = false;
  			break;
  		}
  		i++;
  		j--;
  	}
  	return ok;
  }
  
  static int max(int a, int b) {
  	return Math.max(a, b);
  }
  
  static int min(int a, int b) {
  	return Math.min(a, b);
  }
  
  static long max(long a, long b) {
  	return Math.max(a, b);
  }
  
  static long min(long a, long b) {
  	return Math.min(a, b);
  }
  
  static int abs(int a) {
  	return Math.abs(a);
  }
  
  static long abs(long a) {
  	return Math.abs(a);
  }
  
  static void swap(long arr[], int i, int j) {
  	long temp = arr[i];
  	arr[i] = arr[j];
  	arr[j] = temp;
  }
  
  static void swap(int arr[], int i, int j) {
  	int temp = arr[i];
  	arr[i] = arr[j];
  	arr[j] = temp;
  }
  
  static int maxArr(int arr[]) {
  	int maxi = Integer.MIN_VALUE;
  	for (int x : arr)
  		maxi = max(maxi, x);
  	return maxi;
  }
  
  static int minArr(int arr[]) {
  	int mini = Integer.MAX_VALUE;
  	for (int x : arr)
  		mini = min(mini, x);
  	return mini;
  }
  
  static long maxArr(long arr[]) {
  	long maxi = Long.MIN_VALUE;
  	for (long x : arr)
  		maxi = max(maxi, x);
  	return maxi;
  }
  
  static long minArr(long arr[]) {
  	long mini = Long.MAX_VALUE;
  	for (long x : arr)
  		mini = min(mini, x);
  	return mini;
  }
  
  static int gcd(int a, int b) {
  	if (b == 0)
  		return a;
  	return gcd(b, a % b);
  }
  
  static long gcd(long a, long b) {
  	if (b == 0)
  		return a;
  	return gcd(b, a % b);
  }
  
  static void ruffleSort(int[] a) {
  	int n = a.length;
  	Random r = new Random();
  	for (int i = 0; i < a.length; i++) {
  		int oi = r.nextInt(n);
  		int temp = a[i];
  		a[i] = a[oi];
  		a[oi] = temp;
  	}
  	Arrays.sort(a);
  }
  
  public static int binarySearch(int a[], int target) {
  	int left = 0;
  	int right = a.length - 1;
  	int mid = (left + right) / 2;
  	int i = 0;
  	while (left <= right) {
  		if (a[mid] <= target) {
  			i = mid + 1;
  			left = mid + 1;
  		} else {
  			right = mid - 1;
  		}
  		mid = (left + right) / 2;
  	}
  	return i;
  }
  
  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());
  	}
  
  	int[] readArray(int n) {
  		int[] a = new int[n];
  		for (int i = 0; i < n; i++)
  			a[i] = nextInt();
  		return a;
  	}
  
  	int[][] read2dArray(int n, int m) {
  		int arr[][] = new int[n][m];
  		for (int i = 0; i < n; i++) {
  			for (int j = 0; j < m; j++) {
  				arr[i][j] = nextInt();
  			}
  		}
  		return arr;
  	}
  
  	ArrayList<Integer> readArrayList(int n) {
  		ArrayList<Integer> arr = new ArrayList<Integer>();
  		for (int i = 0; i < n; i++) {
  			int a = nextInt();
  			arr.add(a);
  		}
  		return arr;
  	}
  
  	long nextLong() {
  		return Long.parseLong(next());
  	}
  }
  
  static class pair {
  	int fr, sc;
  
  	pair(int fr, int sc) {
  		this.fr = fr;
  		this.sc = sc;
  	}
  }
  
  ////////////////////////////////////////////////////////////////////////////////////
  ////////////////////DO NOT TOUCH BEFORE THIS LINE //////////////////////////////////
  ////////////////////////////////////////////////////////////////////////////////////
  public static void solve() {
  	int n = sc.nextInt();
  	int m = sc.nextInt();
  	HashMap<Integer, Integer> mpp = new HashMap<Integer, Integer>();
  	for(int i =0;i<m;i++) {
  		int u = sc.nextInt();
  		int v = sc.nextInt();
  		mpp.put(min(u, v), mpp.getOrDefault(min(u, v), 0) + 1);
  //		System.out.println(mpp);
  	}
  	int q = sc.nextInt();
  	for(int ii =0 ;ii<q;ii++) {
  		int tmp = sc.nextInt();
  		if(tmp == 1) {
  			int a = sc.nextInt();
  			int b = sc.nextInt();
  			mpp.put(min(a, b), mpp.getOrDefault(min(a, b), 0) + 1);
  		}
  		if(tmp == 2) {
  			int a = sc.nextInt();
  			int b = sc.nextInt();
  			mpp.put(min(a, b), mpp.get(min(a, b)) - 1);
  			if(mpp.get(min(a, b)) == 0) {
  				mpp.remove(min(a, b));
  			}
  		}
  		if(tmp == 3) {
  			System.out.println(n - mpp.size());
  		}
  //		System.out.println(mpp);
  	}
  }
  
  public static void main(String[] args) {
  	int t = 1;
  //	t = sc.nextInt();
  	outer: for (int tt = 0; tt < t; tt++) {
  		solve();
  	}
  }
  /* Common Mistakes By Me
   * make sure to read the bottom part of question
   * special cases (n=1?)
   * In Game Theory Check your solution and consider all the solutions
   * Always initialise value to the declare array in local scope
   * don't use debugs in interactive problems
   * Always Reset vis,adj array upto n+1 otherwise can cause TLE
  */
  ////////////////////////////////////////////////////////////////////////////////////	
  
  }