#include "bits/stdc++.h"

using namespace std;

class FordFulkerson
{
public:
    using type = int;
    const int INF = 1e9;
    struct Edge
    {
        // 行き先, 容量, 逆辺
        int to;
        type cap;
        int rev;
        Edge(int _t, type _c, int _r) : to(_t), cap(_c), rev(_r) {}
    };

    using Graph = std::vector<std::vector<Edge>>;
    int V;
    Graph G;
    // dfs で訪問済みか
    std::vector<bool> usd;

    // 増加パスを dfs で探す
    type dfs(int v, int t, type f)
    {
        if (v == t)
            return f;
        usd[v] = true;
        for (auto &e : G[v])
        {
            if (!usd[e.to] && e.cap > 0)
            {
                auto d = dfs(e.to, t, std::min(f, e.cap));
                if (d > 0)
                {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    FordFulkerson(int _v) : V(_v), G(_v), usd(_v) {}
    // 無向辺
    void add(int from, int to, type cap)
    {
        G[from].push_back(Edge{to, cap, (int)G[to].size()});
        G[to].push_back(Edge{from, cap, (int)G[from].size() - 1});
    }
    // s->t の最大流を求める
    type maxFlow(int s, int t)
    {
        type ret = 0;
        while (true)
        {
            for (int i = 0; i < (int)G.size(); i++)
                usd[i] = false;
            type f = dfs(s, t, INF);
            if (f == 0)
                return ret;
            ret += f;
        }
    }
    type max2(int s, int t)
    {
        for (int i = 0; i < (int)G.size(); i++)
            usd[i] = false;
        return dfs(s, t, 1);
    }
    void printG()
    {
        for (const auto &v : G)
        {
            cout << "!" << endl;
            for (const auto &e : v)
            {
                cout << e.to << " " << e.cap << endl;
            }
        }
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, e, q;
    cin >> n >> e >> q;
    FordFulkerson flow(n);
    for (int i = 0; i < e; i++)
    {
        int f, t;
        cin >> f >> t;
        f--;
        t--;
        flow.add(f, t, 1);
    }
    int ret = flow.maxFlow(0, n - 1);
    while (q--)
    {
        // cout << "!!!" << endl;
        // flow.printG();
        int m, a, b;
        cin >> m >> a >> b;
        a--;
        b--;

        if (m == 1)
        {
            flow.add(a, b, 1);
            ret += flow.maxFlow(0, n - 1);
            cout << ret << endl;
            continue;
        }
        // 使われてない辺があるか
        bool f = false;
        for (auto &e : flow.G[a])
        {
            if (e.to == b && e.cap == 1)
            {
                f = true;
                int rev = e.rev;
                e.cap = flow.G[e.to][rev].cap = 0;
                break;
            }
        }
        if (f)
        {
            cout << ret << endl;
            continue;
        }
        // a->b に流れているか?
        bool dir = true;
        for (auto &e : flow.G[a])
        {
            if (e.to != b)
                continue;
            // 削除済み辺
            int rev = e.rev;
            if (e.cap == 0 && flow.G[e.to][rev].cap == 0)
                continue;
            if (e.cap != 0)
                dir = false;
            break;
        }
        // cout << (dir ? "TRUE" : "NO") << endl;
        if (!dir)
            swap(a, b);
        // 流せるパスが残っているか
        int p = flow.max2(a, b);
        if (p == 0)
        {
            ret--;
            flow.max2(n - 1, b);
            flow.max2(a, 0);
        }
        for (auto &e : flow.G[a])
        {
            if (e.to != b)
                continue;
            // 削除済み辺
            int rev = e.rev;
            if (e.cap == 0 && flow.G[e.to][rev].cap == 0)
                continue;
            flow.G[e.to][rev].cap = 0;
            break;
        }
        cout << ret << endl;
    }
}



Measured memory_bytes: 3692