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.ByteArrayInputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.util.*;
  
  public class C {
  	static FastReader s;
  	static String INPUT = "";
  
  	public static void main(String[] args) {
  		long time = System.currentTimeMillis();
  		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
  		s = new FastReader(oj);
  		int n = s.nextInt();
  		int m = s.nextInt();
  		Graph graph = new Graph();
  		Set<Integer> connectedToGreaterIntegers = new HashSet<>();
  		for (int i = 0; i < m; i++) {
  			int first = s.nextInt() - 1;
  			int second = s.nextInt() - 1;
  			
  			graph.addConnection(first, second);
  			if(first < second) {
  				connectedToGreaterIntegers.add(first);
  			} else {
  				connectedToGreaterIntegers.add(second);
  			}
  		}
  		int q = s.nextInt();
  		for (int i = 0; i < q; i++) {
  			int qType = s.nextInt();
  			if (qType == 3) {
  				System.out.println(n - connectedToGreaterIntegers.size());
  			} else {
  				int first = s.nextInt() - 1;
  				int second = s.nextInt() - 1;
  				if (qType == 1) {
  					graph.addConnection(first, second);
  					if(first < second) {
  						connectedToGreaterIntegers.add(first);
  					} else {
  						connectedToGreaterIntegers.add(second);
  					}
  					
  				} else {
  					graph.remConnection(first, second);
  					Map<Integer, TreeSet<Integer>> connSet = graph.adjMap;
  					if (first < second) {
  						TreeSet<Integer> fConnSet = connSet.get(first);
  						if (fConnSet != null) {
  							if (fConnSet.higher(first) == null) {
  								connectedToGreaterIntegers.remove(first);
  							}
  						}
  					} else {
  						TreeSet<Integer> fConnSet = connSet.get(second);
  						if (fConnSet != null) {
  							if (fConnSet.higher(second) == null) {
  								connectedToGreaterIntegers.remove(second);
  							}
  						}
  					}
  				}
  			}
  			
  		}
  		
  
  		if (!oj) {
  			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
  		}
  	}
  	
  	private static class Graph {
  		Map<Integer, TreeSet<Integer>> adjMap;
  		
  		public Graph() {
  			// TODO Auto-generated constructor stub
  			adjMap = new HashMap<>();
  		}
  		
  		public void addConnection(int src, int dest) {
  			TreeSet<Integer> connSet = adjMap.getOrDefault(src, new TreeSet<>());
  			connSet.add(dest);
  			adjMap.put(src, connSet);
  			
  			connSet = adjMap.getOrDefault(dest, new TreeSet<>());
  			connSet.add(src);
  			adjMap.put(dest, connSet);
  		}
  		
  		public void remConnection(int src, int dest) {
  			TreeSet<Integer> connSet = adjMap.getOrDefault(src, new TreeSet<>());
  			connSet.remove(dest);
  			adjMap.put(src, connSet);
  			
  			connSet = adjMap.getOrDefault(dest, new TreeSet<>());
  			connSet.remove(src);
  			adjMap.put(dest, connSet);
  		}
  	}
  
  	private static class UnionFindDisjointSet {
  		int[] parent;
  		int[] size;
  		int n;
  		int size1;
  
  		public UnionFindDisjointSet(int n) {
  			this.n = n;
  			this.parent = new int[n];
  			this.size = new int[n];
  			for (int i = 0; i < n; i++) {
  				parent[i] = i;
  			}
  
  			for (int i = 0; i < n; i++) {
  				size[i] = 1;
  			}
  
  			this.size1 = n;
  		}
  
  		private int numDisjointSets() {
  			System.out.println(size1);
  			return size1;
  		}
  
  		private boolean find(int a, int b) {
  			int rootA = root(a);
  			int rootB = root(b);
  			if (rootA == rootB) {
  				return true;
  			}
  			return false;
  		}
  
  		private int root(int b) {
  			while (parent[b] != b) {
  				parent[b] = parent[parent[b]];
  				b = parent[b];
  			}
  			return b;
  		}
  
  		private void union(int a, int b) {
  			int rootA = root(a);
  			int rootB = root(b);
  			if (rootA == rootB) {
  				return;
  			}
  
  			if (size[rootA] < size[rootB]) {
  				parent[rootA] = parent[rootB];
  				size[rootB] += size[rootA];
  			} else {
  				parent[rootB] = parent[rootA];
  				size[rootA] += size[rootB];
  			}
  			size1--;
  			System.out.println(Arrays.toString(parent));
  		}
  	}
  
  	static ArrayList<Long> printDivisors(long n) {
  		// Note that this loop runs till square root
  		ArrayList<Long> list = new ArrayList<>();
  		for (long i = 1; i <= Math.sqrt(n); i++) {
  			if (n % i == 0) {
  				if (n / i == i) {
  					list.add(i);
  				} else {
  					list.add(i);
  					list.add(n / i);
  				}
  			}
  		}
  		return list;
  	}
  
  	//    GCD - Using Euclid theorem.
  	private static long gcd(long a, long b) {
  		if (b == 0) {
  			return a;
  		}
  
  		return gcd(b, a % b);
  	}
  
  	//    Extended euclidean algorithm
  	//    Used to solve equations of the form ax + by = gcd(a,b)
  	//    return array [d, a, b] such that d = gcd(p, q), ap + bq = d
  	static long[] extendedEuclidean(long p, long q) {
  		if (q == 0)
  			return new long[] { p, 1, 0 };
  
  		long[] vals = extendedEuclidean(q, p % q);
  		long d = vals[0];
  		long a = vals[2];
  		long b = vals[1] - (p / q) * vals[2];
  		return new long[] { d, a, b };
  	}
  
  	// X ^ y mod p
  	static long power(long x, long y, long p) {
  		long res = 1;
  		x = x % p;
  
  		while (y > 0) {
  			if ((y & 1) == 1)
  				res = (res * x) % p;
  			y = y >> 1;
  			x = (x * x) % p;
  		}
  		return res;
  	}
  
  	// Returns modulo inverse of a
  	// with respect to m using extended
  	// Euclid Algorithm. Refer below post for details:
  	// https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
  	static long inv(long a, long m) {
  		long m0 = m, t, q;
  		long x0 = 0, x1 = 1;
  
  		if (m == 1)
  			return 0;
  
  		// Apply extended Euclid Algorithm
  		while (a > 1) {
  			q = a / m;
  			t = m;
  			m = a % m;
  			a = t;
  			t = x0;
  			x0 = x1 - q * x0;
  			x1 = t;
  		}
  
  		// Make x1 positive
  		if (x1 < 0)
  			x1 += m0;
  
  		return x1;
  	}
  
  	// k is size of num[] and rem[].
  	// Returns the smallest number
  	// x such that:
  	// x % num[0] = rem[0],
  	// x % num[1] = rem[1],
  	// ..................
  	// x % num[k-2] = rem[k-1]
  	// Assumption: Numbers in num[] are pairwise
  	// coprime (gcd for every pair is 1)
  	static long findMinX(long num[], long rem[], long k) {
  		int prod = 1;
  		for (int i = 0; i < k; i++)
  			prod *= num[i];
  
  		int result = 0;
  		for (int i = 0; i < k; i++) {
  			long pp = prod / num[i];
  			result += rem[i] * inv(pp, num[i]) * pp;
  		}
  
  		return result % prod;
  	}
  
  	//  Binary search
  	private static int binarySearch(int[] arr, int ele) {
  		int low = 0;
  		int high = arr.length - 1;
  		while (low <= high) {
  			int mid = (low + high) / 2;
  			if (arr[mid] == ele) {
  				return mid;
  			} else if (ele < arr[mid]) {
  				high = mid - 1;
  			} else {
  				low = mid + 1;
  			}
  		}
  		return -1;
  	}
  
  	//    First occurence using binary search
  	private static int binarySearchFirstOccurence(int[] arr, int ele) {
  		int low = 0;
  		int high = arr.length - 1;
  		int ans = -1;
  		while (low <= high) {
  			int mid = (low + high) / 2;
  			if (arr[mid] == ele) {
  				ans = mid;
  				high = mid - 1;
  			} else if (ele < arr[mid]) {
  				high = mid - 1;
  			} else {
  				low = mid + 1;
  			}
  		}
  		return ans;
  	}
  
  	//    Last occurenece using binary search
  	private static int binarySearchLastOccurence(int[] arr, int ele) {
  		int low = 0;
  		int high = arr.length - 1;
  		int ans = -1;
  		while (low <= high) {
  			int mid = (low + high) / 2;
  			if (arr[mid] == ele) {
  				ans = mid;
  				low = mid + 1;
  			} else if (ele < arr[mid]) {
  				high = mid - 1;
  			} else {
  				low = mid + 1;
  			}
  		}
  		return ans;
  	}
  
  	// Merge sort
  	static void merge(int arr[], int l, int m, int r) {
  		int n1 = m - l + 1;
  		int n2 = r - m;
  		int L[] = new int[n1];
  		int R[] = new int[n2];
  		for (int i = 0; i < n1; ++i)
  			L[i] = arr[l + i];
  		for (int j = 0; j < n2; ++j)
  			R[j] = arr[m + 1 + j];
  		int i = 0, j = 0;
  		int k = l;
  		while (i < n1 && j < n2) {
  			if (L[i] <= R[j]) {
  				arr[k] = L[i];
  				i++;
  			} else {
  				arr[k] = R[j];
  				j++;
  			}
  			k++;
  		}
  
  		while (i < n1) {
  			arr[k] = L[i];
  			i++;
  			k++;
  		}
  
  		while (j < n2) {
  			arr[k] = R[j];
  			j++;
  			k++;
  		}
  	}
  
  	static void sort(int arr[], int l, int r) {
  		if (l < r) {
  			int m = (l + r) / 2;
  			sort(arr, l, m);
  			sort(arr, m + 1, r);
  			merge(arr, l, m, r);
  		}
  	}
  
  	static void sort(int[] arr) {
  		sort(arr, 0, arr.length - 1);
  	}
  
  	private static class FastReader {
  		InputStream is;
  
  		public FastReader(boolean onlineJudge) {
  			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
  		}
  
  		byte[] inbuf = new byte[1024];
  		public int lenbuf = 0, ptrbuf = 0;
  
  		int readByte() {
  			if (lenbuf == -1)
  				throw new InputMismatchException();
  			if (ptrbuf >= lenbuf) {
  				ptrbuf = 0;
  				try {
  					lenbuf = is.read(inbuf);
  				} catch (IOException e) {
  					throw new InputMismatchException();
  				}
  				if (lenbuf <= 0)
  					return -1;
  			}
  			return inbuf[ptrbuf++];
  		}
  
  		boolean isSpaceChar(int c) {
  			return !(c >= 33 && c <= 126);
  		}
  
  		int skip() {
  			int b;
  			while ((b = readByte()) != -1 && isSpaceChar(b))
  				;
  			return b;
  		}
  
  		double nextDouble() {
  			return Double.parseDouble(next());
  		}
  
  		char nextChar() {
  			return (char) skip();
  		}
  
  		String next() {
  			int b = skip();
  			StringBuilder sb = new StringBuilder();
  			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
  				sb.appendCodePoint(b);
  				b = readByte();
  			}
  			return sb.toString();
  		}
  
  		String nextLine() {
  			int b = skip();
  			StringBuilder sb = new StringBuilder();
  			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
  				sb.appendCodePoint(b);
  				b = readByte();
  			}
  			return sb.toString();
  		}
  
  		char[] next(int n) {
  			char[] buf = new char[n];
  			int b = skip(), p = 0;
  			while (p < n && !(isSpaceChar(b))) {
  				buf[p++] = (char) b;
  				b = readByte();
  			}
  			return n == p ? buf : Arrays.copyOf(buf, p);
  		}
  
  		int nextInt() {
  			int num = 0, b;
  			boolean minus = false;
  			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
  				;
  			if (b == '-') {
  				minus = true;
  				b = readByte();
  			}
  
  			while (true) {
  				if (b >= '0' && b <= '9') {
  					num = num * 10 + (b - '0');
  				} else {
  					return minus ? -num : num;
  				}
  				b = readByte();
  			}
  		}
  
  		long nextLong() {
  			long num = 0;
  			int b;
  			boolean minus = false;
  			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
  				;
  			if (b == '-') {
  				minus = true;
  				b = readByte();
  			}
  
  			while (true) {
  				if (b >= '0' && b <= '9') {
  					num = num * 10 + (b - '0');
  				} else {
  					return minus ? -num : num;
  				}
  				b = readByte();
  			}
  		}
  
  		char[][] nextMatrix(int n, int m) {
  			char[][] map = new char[n][];
  			for (int i = 0; i < n; i++)
  				map[i] = next(m);
  			return map;
  		}
  
  		int[] nextIntArray(int n) {
  			int[] a = new int[n];
  			for (int i = 0; i < n; i++)
  				a[i] = nextInt();
  			return a;
  		}
  
  		long[] nextLongArray(int n) {
  			long[] a = new long[n];
  			for (int i = 0; i < n; i++)
  				a[i] = nextLong();
  			return a;
  		}
  
  		int[][] next2DInt(int n, int m) {
  			int[][] arr = new int[n][];
  			for (int i = 0; i < n; i++) {
  				arr[i] = nextIntArray(m);
  			}
  			return arr;
  		}
  
  		long[][] next2DLong(int n, int m) {
  			long[][] arr = new long[n][];
  			for (int i = 0; i < n; i++) {
  				arr[i] = nextLongArray(m);
  			}
  			return arr;
  		}
  
  		int[] shuffle(int[] arr) {
  			Random r = new Random();
  			for (int i = 1, j; i < arr.length; i++) {
  				j = r.nextInt(i);
  				arr[i] = arr[i] ^ arr[j];
  				arr[j] = arr[i] ^ arr[j];
  				arr[i] = arr[i] ^ arr[j];
  			}
  			return arr;
  		}
  
  		int[] uniq(int[] arr) {
  			Arrays.sort(arr);
  			int[] rv = new int[arr.length];
  			int pos = 0;
  			rv[pos++] = arr[0];
  			for (int i = 1; i < arr.length; i++) {
  				if (arr[i] != arr[i - 1]) {
  					rv[pos++] = arr[i];
  				}
  			}
  			return Arrays.copyOf(rv, pos);
  		}
  	}
  }
  
  