using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
//using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var m = sc.Integer();
            var q = sc.Integer();
            var es = new Pair<int, int>[m + q];
            var E = new Pair<int, int>[m];
            var A = new int[q];
            var Q = new Pair<int, int>[q];
            for (int i = 0; i < m; i++)
            {
                var f = sc.Integer() - 1;
                var t = sc.Integer() - 1;
                if (f > t) Swap(ref f, ref t);
                E[i] = Pair.Create(f, t);
                es[i] = Pair.Create(f, t);

            }
            for (int i = 0; i < q; i++)
            {
                var a = sc.Integer();
                var f = sc.Integer() - 1;
                var t = sc.Integer() - 1;
                if (f > t) Swap(ref f, ref t);
                es[m + i] = Pair.Create(f, t);
                A[i] = a;
                Q[i] = Pair.Create(f, t);
            }
            es = es.Distinct().ToArray();
            Array.Sort(es);
            var sz = es.Length;
            var pos = new int[sz];
            for (int i = 0; i < sz; i++)
                pos[i] = -1;
            var G = Enumerate(n, x => new List<Edge<int>>());
            for (int i = 0; i < m; i++)
            {
                var p = Array.BinarySearch(es, E[i]);
                pos[p] = G[es[p].x].Count;
                G.AddUndirectedEdge(es[p].x, es[p].y, 1);
            }
            for (int i = 0; i < q; i++)
            {
                if (A[i] == 1)
                {
                    var p = Array.BinarySearch(es, Q[i]);
                    if (pos[p] == -1)
                    {
                        pos[p] = G[es[p].x].Count;
                        G.AddUndirectedEdge(es[p].x, es[p].y, 0);
                    }
                }
            }
            var H = Enumerate(n, x => G[x].ToArray());
            var flow = Flow.FordFulkerson(H, 0, n - 1);
            for (int i = 0; i < q; i++)
            {
                if (A[i] == 1)
                {
                    var p = Array.BinarySearch(es, Q[i]);
                    var u = Q[i].x;
                    var v = Q[i].y;
                    p = pos[p];
                    Debug.Assert(H[u][p].cap == 0);
                    H[u][p].cap = 1;
                    H[v][H[u][p].rev].cap = 1;
                    flow += Flow.FordFulkerson(H, 0, n - 1);
                }
                else
                {
                    var p = Array.BinarySearch(es, Q[i]);
                    p = pos[p];
                    var u = Q[i].x;
                    var v = Q[i].y;
                    if (H[u][p].cap == 2 && Flow.FordFulkerson(H, v, u, 1) == 0)
                    {
                        Flow.FordFulkerson(H, n - 1, 0, 1);
                        Flow.FordFulkerson(H, v, u, 1);
                        flow--;
                    }
                    else if (H[u][p].cap == 0 && Flow.FordFulkerson(H, u, v, 1) == 0)
                    {
                        Flow.FordFulkerson(H, n - 1, 0, 1);
                        Flow.FordFulkerson(H, u, v, 1);
                        flow--;
                    }
                    //Debug.Assert(H[u][p].cap == 1);
                    H[Q[i].x][p].cap = 0;
                    H[Q[i].y][H[Q[i].x][p].rev].cap = 0;
                }
                IO.Printer.Out.WriteLine(flow);
            }
        }
        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex
{
    //static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    //static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer : StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion
#region Edge
public struct Edge<T>
{
    public int to, rev;
    public T cap;
    public Edge(int t, int r, T _cap) { to = t; rev = r; cap = _cap; }
    public override string ToString() { return string.Format("{0}: Capacity {1}", to, cap); }
}
#endregion
#region AddEdge
static public partial class Flow
{
    static public void AddDirectedEdge(this List<Edge<int>>[] G, int from, int to, int cap)
    {
        G[from].Add(new Edge<int>(to, G[to].Count, cap));
        G[to].Add(new Edge<int>(from, G[from].Count - 1, 0));
    }
    static public void AddUndirectedEdge(this List<Edge<int>>[] G, int from, int to, int cap)
    {
        G[from].Add(new Edge<int>(to, G[to].Count, cap));
        G[to].Add(new Edge<int>(from, G[from].Count - 1, cap));
    }
    static public void AddDirectedEdge(this List<Edge<long>>[] G, int from, int to, long cap)
    {
        G[from].Add(new Edge<long>(to, G[to].Count, cap));
        G[to].Add(new Edge<long>(from, G[from].Count - 1, 0));
    }
    static public void AddUndirectedEdge(this List<Edge<long>>[] G, int from, int to, long cap)
    {
        G[from].Add(new Edge<long>(to, G[to].Count, cap));
        G[to].Add(new Edge<long>(from, G[from].Count - 1, cap));
    }
}
#endregion

#region Compair
static public class Pair
{
    static public Pair<FT, ST> Create<FT, ST>(FT f, ST s)
        where FT : IComparable<FT>
        where ST : IComparable<ST>
    { return new Pair<FT, ST>(f, s); }
    static public Pair<FT, ST> Min<FT, ST>(Pair<FT, ST> p, Pair<FT, ST> q)
        where FT : IComparable<FT>
        where ST : IComparable<ST>
    { return (p.CompareTo(q) <= 0) ? p : q; }
    static public Pair<FT, ST> Max<FT, ST>(Pair<FT, ST> p, Pair<FT, ST> q)
        where FT : IComparable<FT>
        where ST : IComparable<ST>
    { return (p.CompareTo(q) >= 0) ? p : q; }
}
public struct Pair<FT, ST> : IComparable<Pair<FT, ST>>
    where FT : IComparable<FT>
    where ST : IComparable<ST>
{
    public FT x;
    public ST y;
    public Pair(FT f, ST s) : this() { x = f; y = s; }

    public int CompareTo(Pair<FT, ST> other)
    {
        var cmp = x.CompareTo(other.x);
        return cmp != 0 ? cmp : y.CompareTo(other.y);
    }
    public override string ToString() { return string.Format("{0} {1}", x, y); }
}
#endregion
#region Ford-Fulkerson
static public partial class Flow
{
    /// <summary>return Max Flow O(|F||E|)</summary>
    static public int FordFulkerson(Edge<int>[][] G, int s, int t, int INF = -1)
    {
        var used = new bool[G.Length];
        Func<int, int, int, int> dfs = null;
        dfs = (v, u, f) =>
        {
            if (v == u) return f;
            used[v] = true;
            for (int i = 0; i < G[v].Length; i++)
                if (!used[G[v][i].to] && G[v][i].cap > 0)
                {
                    var d = dfs(G[v][i].to, u, Math.Min(f, G[v][i].cap));
                    if (d <= 0) continue;
                    G[v][i].cap -= d;
                    G[G[v][i].to][G[v][i].rev].cap += d;
                    return d;
                }
            return 0;
        };
        var flow = 0;
        if (INF == -1)
        {
            while (true)
            {
                Array.Clear(used, 0, used.Length);
                var f = dfs(s, t, 1 << 30);
                if (f == 0) return flow;
                flow += f;
            }
        }
        else
        {
            while (INF > 0)
            {
                Array.Clear(used, 0, used.Length);
                var f = dfs(s, t, INF);
                if (f == 0) return flow;
                flow += f;
                INF -= f;

            }
            return flow;
        }

    }
}
#endregion


Measured memory_bytes: 13244