#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

#define size(v) v.size()

template <class T, bool Scaling = false> struct dinic {
  struct edge {
    int to;
    T cap;
  };
  const T inf = numeric_limits<T>::max(), eps = 1e-10;
  int n, s, t;
  vector<edge> es;
  vector<vector<int>> g;
  T scale;
  vector<int> h, ptr;
  dinic(int _n, int _s, int _t) : n(_n), s(_s), t(_t), g(n), h(n), ptr(n) {}
  void add(int from, int to, T cap, T rev_cap = 0) {
    g[from].push_back(size(es)), es.push_back({to, cap});
    g[to].push_back(size(es)), es.push_back({from, rev_cap});
  }
  bool bfs() {
    static vector<int> que(n);
    fill(begin(h), end(h), -1);
    h[t] = 0, que[0] = t;
    for (int bg = 0, ed = 1; bg < ed; ) {
      int v = que[bg++];
      for (int id : g[v])
        if (es[id ^ 1].cap > scale and h[es[id].to] == -1) {
          h[es[id].to] = h[v] + 1, que[ed++] = es[id].to;
          if (es[id].to == s) return true;
        }
    }
    return false;
  }
  T dfs(int v, T f) {
    if (v == t) return f;
    for (int& i = ptr[v]; i >= 0; --i) {
      int id = g[v][i];
      if (es[id].cap > scale and h[v] > h[es[id].to]) {
        T df = dfs(es[id].to, min(f, es[id].cap));
        if (df > eps) return es[id].cap -= df, es[id ^ 1].cap += df, df;
      }
    }
    return 0;
  }
  T max_flow(T upper = numeric_limits<T>::max()) {
    T flow = 0, max_cap = 0;
    for (auto&& e : es) max_cap = max(max_cap, e.cap);
    for (scale = Scaling ? max_cap / 2 : eps; ; scale /= 2) {
      while (bfs()) {
        for (int v = 0; v < n; ++v) ptr[v] = (int)size(g[v]) - 1;
        for (T df; (df = dfs(s, upper - flow)) > eps; ) flow += df;
        if (flow == upper) break;
      }
      if (scale <= eps) break;
    }
    return flow;
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  dinic<int> g(n, 0, n - 1);
  vector<vector<int>> eid(n, vector<int>(n, -1));
  while (m--) {
    int f, t;
    cin >> f >> t;
    --f, --t;
    tie(f, t) = minmax({f, t});
    eid[f][t] = size(g.es);
    g.add(f, t, 1, 1);
  }
  int res = g.max_flow();
  while (q--) {
    int t, a, b;
    cin >> t >> a >> b;
    --a, --b;
    tie(a, b) = minmax({a, b});
    if (t == 1) {
      if (eid[a][b] == -1) {
        eid[a][b] = size(g.es);
        g.add(a, b, 1, 1);
      } else {
        int id = eid[a][b];
        assert(g.es[id].cap == 0);
        assert(g.es[id ^ 1].cap == 0);
        g.es[id].cap = 1;
        g.es[id ^ 1].cap = 1;
      }
      res += g.max_flow();
    } else {
      int id = eid[a][b];
      if (g.es[id].cap == 1) {
        assert(g.es[id ^ 1].cap == 1);
        g.es[id].cap = 0;
        g.es[id ^ 1].cap = 0;
      } else {
        if (g.es[id].cap) {
          assert(g.es[id].cap == 2);
          assert(g.es[id ^ 1].cap == 0);
          swap(a, b);
          id ^= 1;
        }
        assert(g.es[id].cap == 0);
        assert(g.es[id ^ 1].cap == 2);
        g.es[id ^ 1].cap = 0;
        g.s = a, g.t = b;
        if (g.max_flow(1) == 0) {
          if (a) {
            g.s = a, g.t = 0;
            g.max_flow(1);
          }
          if (b != n - 1) {
            g.s = n - 1, g.t = b;
            g.max_flow(1);
          }
          --res;
        }
        g.s = 0, g.t = n - 1;
      }
    }
    cout << res << '\n';
  }
}



Measured memory_bytes: 4416