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>
3 0
2
1 2 1
3
 20 0
1
3
 1000 0
1
3
 20 0
20
3
3
1 17 19
1 19 20
1 4 8
1 9 18
1 1 14
1 16 19
1 10 19
1 1 7
1 6 10
1 18 19
1 9 16
1 15 17
1 11 12
1 10 15
3
1 2 9
1 1 13
1 16 20
 20 53
1 2
1 4
1 5
1 6
1 7
1 8
1 20
2 3
2 6
2 16
2 17
3 6
3 18
3 20
4 6
4 7
4 8
4 9
4 14
4 18
5 11
5 13
5 17
5 18
5 19
6 8
6 13
7 8
7 10
7 15
7 17
7 18
8 15
8 16
9 10
9 15
10 11
10 17
10 20
11 15
11 16
12 14
12 15
12 16
12 19
14 16
14 19
16 17
16 19
16 20
17 19
17 20
18 19
1
3

2
 20
 1000
 20
20
9
 4

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class webOfLies2
{
    private static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(
                    new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static FastReader sc = new FastReader();

    public static void main(String[] args) throws Exception
    {
             solve2();
    }

    static int ans;
    private static void solve2()
    {
        int n = sc.nextInt(); // no of nobles
        int m = sc.nextInt(); // no of friendships

        int[] weaker = new int[n+1]; // no of weaker friends
        int[] friends = new int[n+1];  // total friends

        for (int i = 0; i < m; i++)
        {
            int u = sc.nextInt();
            int v = sc.nextInt();

            change(weaker, friends, u, v, +1);
        }

        // get all the initially safe nobles
        ans = 0;
        for (int i = 1; i <= n; i++) {
            if(weaker[i] == friends[i]) ans++;
        }

        int quer = sc.nextInt();

        while( quer-- >0 )
        {
            int type = sc.nextInt();
            if (type == 1 || type == 2) {
                int a = sc.nextInt()-1;
                int b = sc.nextInt()-1;
                update(weaker, friends, a,b,type);
            } else {
                System.out.println(ans);
            }

        }
    }

    //process an update
    public static void update(int[] weaker, int[] friends, int a, int b, int type)
    {
        int prev = survive(weaker, friends, a)+survive(weaker, friends, b); // old answer, for which one would have survived

        if (type==1)
        {
            change(weaker, friends, a,b,1);
        }
        else
        {
            change(weaker, friends, a,b,-1);
        }
        int next = survive(weaker, friends, a)+survive(weaker, friends, b);  // new answer, for which one will now survive

        ans += (next-prev); // add the difference to ans
    }

    //does noble a survive?
    public static int survive(int[] weaker, int[] friends, int a) {
        if (weaker[a]==friends[a])
            return 1;
        else
            return 0;
    }

    private static void change(int[] weaker, int[] friends, int u, int v, int i) // i=+1 if we've to add a friendship, -1 if we've to remove a friendship
    {
        // friends of both increased
        friends[u] += i;
        friends[v] += i;

        // a weaker friend of the stronger one got removed (-1) or added (+1)
        if(u<v)
            weaker[v] += i;

        else weaker[u] += i;
    }

    // correct but, TLE
    private static void solve()
    {

        int n = sc.nextInt(); // no of nobles
        int m = sc.nextInt(); // no of friendships
        HashMap<Integer,  HashSet<Integer> > g = new HashMap<>();


        for (int i = 1; i <= n; i++) {
            g.put(i, new HashSet<>());
        }


        // m friendships
        for (int i = 0; i < m; i++)
        {
            int u = sc.nextInt();;
            int v = sc.nextInt();;

            g.get(u).add(v);
            g.get(v).add(u);

        }
//        System.out.println(g);

        int quer = sc.nextInt();

        while(quer-- >0)
        {
            int q = sc.nextInt();

            if(q==1){
                int u = sc.nextInt();
                int v = sc.nextInt();
                g.get(u).add(v);
                g.get(v).add(u);
            }
            else if(q==2){
                int u = sc.nextInt();
                int v = sc.nextInt();
                g.get(u).remove(v);
                g.get(v).remove(u);
            }
            else {
                HashMap<Integer,  HashSet<Integer> > g2 = new HashMap<>(g);
//                System.out.println(g2);
                removeVulnerable(g2);
            }

        }


    }

    private static void removeVulnerable(HashMap<Integer,  HashSet<Integer> > g)
    {
        boolean allSafe = false;

        // loop will break if all the left nobles are safe

        // safe => 1) have no friend   or   2) have all smaller friends
        // all safe => no friends, coz all smaller friends will be deleted

        while(!allSafe)
        {
            ArrayList<Integer> delete = new ArrayList<>(); // keep an AL to store which nobles to kill

            // iterate for all the nobles alive
            for( Map.Entry<Integer,  HashSet<Integer>>  e : g.entrySet())
            {
                int noble = e.getKey(); // get the noble

                boolean allBig = true; // if all its neighbours a larger => it'll get deleted

                // check all its friends
                for( Integer friend : e.getValue())
                {
                    // if any 1 friend is smaller, means won't be deleted in this iteration
                    if(friend<noble){
                        allBig = false;
                        break;
                    }
                }
                if(e.getValue().size()==0) allBig = false; // also if has no friends, means is safe

                // if all neighbours were big => add to delete list
                if(allBig){
                    delete.add(noble);
//                    allSafe = false;
                }
            }

            if(delete.size()==0) allSafe=true; // if no nobles are to be killed => all are safe now. Done

            else // else delete the nobles
            {
                for(int x : delete) // for each noble to be deleted
                {
                    // get all its neighbours, and delete it from them
                    for(int nbr : g.get(x) )
                        if(g.containsKey(nbr))
                        g.get(nbr).remove(x);

                    g.remove(x);/// now delete this one from main graph
                }
            }

        }


        System.out.println(g.size());
    }

}
