#include<iostream>
#include<algorithm>
#include<cstdio>
#include<map>
#include<stack>
#include<cmath>
using namespace std;
int live[300050];
int main()
{
int n,m;
int N;
cin >> n >> m;
while(m--)
{
int a,b;
cin >> a >> b;
int min;
if(a>b)
live[b]++;
else
live[a]++;
}
int ans=0;
for(int i=0;i<n;i++)
if(live[i]==0)
ans++;
scanf("%d",&N);
for(int i=0;i<N;i++)
{
int flag;
int x,y;
cin >>flag;
if(flag==1)
{
cin >> x >> y;
if(x>y)
swap(x,y);
live[x]++;
if(live[x]==1)
ans--;
}
if(flag==2)
{
cin >> x >> y;
if(x>y)
swap(x,y);
live[x]--;
if(live[x]==0)
ans++;
}
if(flag==3)
cout << ans << endl;
}
return 0;
}
该题有拓扑排序的意思= =(我是蒟蒻当时只想的用数组存权力比它大的然后输出后续意识到优点拓扑排序的意思 QAQ 还是太菜了)