#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()


//const int INF = 2147483647;
//const long long int L_INF = 9223372036854775807;

typedef int Weight;

const Weight INF =INT_MAX/2;
const Weight ZERO = 0;
struct Edge {
	int src, dst;
	Weight weight;
	int id;
	Edge(int src_, int dst_, Weight weight_, const int id_) :
		src(src_), dst(dst_), weight(weight_), id(id_) { }
	Edge(int src, int dst, Weight weight) :
		src(src), dst(dst), weight(weight) { }
	Edge() :src(0), dst(0), weight(0) {

	}
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;
#define RESIDUE(s,t) (capacity[s][t]-flow[s][t])

//??????0??????????????????????????¨??£???????±??????????????????§??¨???
Weight maximumFlow(const Graph &ag, int s, int t) {

	Graph g(ag);
	for (int i = 0; i < ag.size(); ++i) {
		for (int j = 0; j < ag[i].size(); ++j) {
			int d = ag[i][j].dst;
			int s = ag[i][j].src;

			bool ok = false;
			for (int k = 0; k < ag[d].size(); ++k) {
				if (ag[d][k].src == s) {
					ok = true;
					break;
				}
			}
			if (!ok) {
				g[d].push_back(Edge(d, s, ZERO));
			}
		}
	}
	int n = g.size();
	Matrix flow(n, Array(n,ZERO)), capacity(n, Array(n,ZERO));
	REP(u, n) FOR(e, g[u]) capacity[e->src][e->dst] =capacity[e->src][e->dst]+ e->weight;


	Weight total = ZERO;
	while (1) {
		queue<int> Q; Q.push(s);
		vector<int> prev(n, -1); prev[s] = s;
		while (!Q.empty() && prev[t] < 0) {
			int u = Q.front(); Q.pop();
			FOR(e, g[u]) if (prev[e->dst] < 0 && RESIDUE(u, e->dst) > ZERO) {
				prev[e->dst] = u;
				Q.push(e->dst);
			}
		}
		if (prev[t] < 0)break; // prev[x] == -1 <=> t-side
		Weight inc = INF;
		for (int j = t; prev[j] != j; j = prev[j]){
			auto v(RESIDUE(prev[j], j));
			if (inc > v) {
				inc = v;
			}
		}
		for (int j = t; prev[j] != j; j = prev[j])
			flow[prev[j]][j] =flow[prev[j]][j]+inc, flow[j][prev[j]] =flow[j][prev[j]]- inc;;
		total += inc;
	}

	return total;
}

int main()
{
	int N,E,Q;cin>>N>>E>>Q;
	Graph g(N);
	int s=0;
	int t=N-1;
	{
		for (int i = 0; i < E; ++i) {
			int a, b; cin >> a >> b;
			a--; b--;
			g[a].push_back(Edge{ a,b,1 });
			g[b].push_back(Edge{ b,a,1 });
		}
	}

	int n = g.size();
	Matrix flow(n, Array(n, ZERO)), capacity(n, Array(n, ZERO));
	REP(u, n) FOR(e, g[u]) capacity[e->src][e->dst] = capacity[e->src][e->dst] + e->weight;

	Weight now_sum=0;
	{
		Weight total = ZERO;
		while (1) {
			queue<int> Q; Q.push(s);
			vector<int> prev(n, -1); prev[s] = s;
			while (!Q.empty() && prev[t] < 0) {
				int u = Q.front(); Q.pop();
				FOR(e, g[u]) if (prev[e->dst] < 0 && RESIDUE(u, e->dst) > ZERO) {
					prev[e->dst] = u;
					Q.push(e->dst);
				}
			}
			if (prev[t] < 0)break; // prev[x] == -1 <=> t-side
			Weight inc = INF;
			for (int j = t; prev[j] != j; j = prev[j]) {
				auto v(RESIDUE(prev[j], j));
				if (inc > v) {
					inc = v;
				}
			}
			for (int j = t; prev[j] != j; j = prev[j])
				flow[prev[j]][j] = flow[prev[j]][j] + inc, flow[j][prev[j]] = flow[j][prev[j]] - inc;;
			total += inc;
		}
		now_sum=total;
	}
	
	for (int i = 0; i < Q; ++i) {
		int at,a,b;cin>>at>>a>>b;
		a--;b--;
		//connect
		if (at == 1) {
			capacity[a][b]=1;
			capacity[b][a]=1;
			if (find_if(g[a].begin(), g[a].end(), [&](const Edge&e) {
				return e.dst == b;
			}) == g[a].end()) {
				g[a].push_back(Edge(a,b,1));
				g[b].push_back(Edge(b,a,1));
			}
			Weight total=0;
			while (1) {
				queue<int> Q; Q.push(s);
				vector<int> prev(n, -1); prev[s] = s;
				while (!Q.empty() && prev[t] < 0) {
					int u = Q.front(); Q.pop();
					FOR(e, g[u]) if (prev[e->dst] < 0 && RESIDUE(u, e->dst) > ZERO) {
						prev[e->dst] = u;
						Q.push(e->dst);
					}
				}
				if (prev[t] < 0)break; // prev[x] == -1 <=> t-side
				Weight inc = INF;
				for (int j = t; prev[j] != j; j = prev[j]) {
					auto v(RESIDUE(prev[j], j));
					if (inc > v) {
						inc = v;
					}
				}
				for (int j = t; prev[j] != j; j = prev[j])
					flow[prev[j]][j] = flow[prev[j]][j] + inc, flow[j][prev[j]] = flow[j][prev[j]] - inc;;
				total += inc;
			}
			now_sum+=total;
		}
		//disconnect
		else {
			if (flow[a][b] == -1) {
				swap(a,b);
			}
			auto it = find_if(g[a].begin(), g[a].end(), [&](const Edge&e) {
				return e.dst==b;
			});
			g[a].erase(it);
			g[b].erase(find_if(g[b].begin(), g[b].end(), [&](const Edge&e) {
				return e.dst==a;
			}));

			capacity[a][b] = 0;
			capacity[b][a] = 0;
			if (flow[a][b]==1) {
				{
					queue<int>que;
					vector<int>prevs(N,-1);
					que.push(s);
					prevs[s]=-2;
					while (!que.empty()) {
						const int now = que.front();
						if (now == a)break;
						que.pop();
						for (int next = 0; next < N; ++next) {
							if (flow[now][next]==1&&prevs[next]==-1) {
								que.push(next);
								prevs[next] = now;
							}
						}
					}
					assert(prevs[a]!=-1);
					int nn(a);
					while (prevs[nn] != -2) {
						int pr=prevs[nn];
						flow[pr][nn]=0;
						flow[nn][pr]=0;
						nn=pr;
					}
				}
				{
					queue<int>que;
					vector<int>prevs(N, -1);
					que.push(b);
					prevs[b]=-2;
					while (!que.empty()) {
						const int now = que.front();
						if (now ==t)break;
						que.pop();
						for (int next = 0; next < N; ++next) {
							if (flow[now][next]==1&&prevs[next]==-1) {
								que.push(next);
								prevs[next] = now;
							}
						}
					}
					assert(prevs[t] != -1);
					int nn(t);
					while (prevs[nn] != -2) {
						int pr = prevs[nn];
						flow[pr][nn] = 0;
						flow[nn][pr]=0;
						nn = pr;
					}
				}
				flow[a][b]=0;
				flow[b][a]=0;
				capacity[a][b]=0;
				capacity[b][a]=0;

				Weight total = 0;
				while (1) {
					queue<int> Q; Q.push(s);
					vector<int> prev(n, -1); prev[s] = s;
					while (!Q.empty() && prev[t] < 0) {
						int u = Q.front(); Q.pop();
						FOR(e, g[u]) if (prev[e->dst] < 0 && RESIDUE(u, e->dst) > ZERO) {
							prev[e->dst] = u;
							Q.push(e->dst);
						}
					}
					if (prev[t] < 0)break; // prev[x] == -1 <=> t-side
					Weight inc = INF;
					for (int j = t; prev[j] != j; j = prev[j]) {
						auto v(RESIDUE(prev[j], j));
						if (inc > v) {
							inc = v;
						}
					}
					for (int j = t; prev[j] != j; j = prev[j])
						flow[prev[j]][j] = flow[prev[j]][j] + inc, flow[j][prev[j]] = flow[j][prev[j]] - inc;;
					total += inc;
				}
				now_sum += total-1;
			}
			else {
				int x=0;
				x++;
			}
		}
		cout << now_sum << endl;
	}
	{

	}
	
	
	
	return 0;
}

Measured memory_bytes: 5756