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7
2 9 1
2 9 2
 10 5 6
1 2
2 3
2 4
4 5
1 6
2 3 1
2 6 4
2 1 1
1 5
1 6
1 4
 10 6 7
1 2
2 3
1 4
3 5
1 6
5 7
1 1
2 8 10
1 10
2 9 5
1 7
1 4
2 1 9
 100 16 46
36 42
36 50
42 54
42 74
50 58
42 16
50 81
50 96
42 62
54 2
74 75
74 22
2 48
50 95
74 66
75 5
1 62
1 56
2 6 68
1 47
1 43
1 38
1 75
2 22 82
2 56 77
1 71
2 52 15
2 9 1
2 12 59
1 24
2 41 94
2 18 58
2 22 67
1 45
2 68 70
1 81
1 48
1 71
2 76 28
2 31 73
2 58 80
2 100 57
2 88 79
1 30
2 96 23
2 92 44
1 12
1 66
1 24
2 71 68
2 4 4
2 84 43
2 80 15
2 54 13
1 51
2 99 17
1 63
2 12 41
2 1 2
2 62 96
2 79 9
2 59 79
 10 1 9
1 2
1 5
2 7 4
1 4
1 7
2 2 5
2 6 3
1 3
1 4
1 2
 10 5 77
1 2
1 3
3 4
1 5
5 6
1 2
2 3 10
2 5 1
1 2
1 4
2 7 7
2 7 9
1 7
2 4 9
2 2 4
2 3 2
2 5 2
2 10 1
2 3 8
1 9
1 4
1 2
2 8 3
2 8 2
2 2 3
2 5 9
1 10
2 3 10
2 5 9
1 2
1 7
1 4
1 4
1 3
1 4
1 10
2 8 7
1 2
2 3 1
1 10
2 7 7
1 2
1 5
1 3
1 8
2 7 7
1 10
2 4 2
1 9
2 6 6
1 3
1 2
2 8 10
1 1
1 7
2 10 7
1 8
1 9
2 1 4
2 1 1
2 3 3
1 9
1 8
2 9 4
1 4
2 4 4
1 6
2 9 4
2 5 10
1 4
2 8 9
1 10
1 4
1 4
1 10
1 2
1 4
1 7
2 10 8
1 2
2 6 6
2 8 5
 10 4 46
1 2
2 3
1 4
2 5
1 5
1 9
2 6 8
2 10 8
1 1
1 5
1 1
2 6 6
1 8
2 9 3
1 2
1 5
1 2
2 6 5
1 2
1 6
2 5 3
1 5
2 10 5
1 5
2 6 10
2 2 3
2 7 9
2 8 9
1 8
1 3
2 7 1
2 2 2
1 2
1 1
1 5
2 8 7
1 3
1 4
1 3
2 3 1
2 8 8
1 10
1 9
1 10
2 7 10
2 8 9
1 4
2 8 9
1 5
2 6 9
 10 7 26
1 2
2 3
3 4
3 5
4 6
2 7
5 8
2 7 10
1 3
2 8 5
2 9 4
2 5 1
1 5
1 8
1 10
1 3
1 9
1 6
2 1 9
2 5 7
2 1 4
1 6
2 6 7
1 3
1 1
1 3
1 2
2 8 3
2 2 5
1 1
2 7 7
2 5 1
2 1 8
 10 6 21
1 2
2 3
2 4
2 5
4 6
2 7
2 4 1
1 1
2 5 1
1 5
1 3
1 3
1 10
1 5
1 7
1 4
2 6 3
2 7 4
1 10
2 2 5
1 1
1 5
1 8
2 5 7
1 3
2 2 9
1 7

3
0
 2
2
2
 3
0
 4
4
4
0
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
 5
5
5
5
5
5
 4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
 0
9
0
0
 6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
 4
4
4
4
 5
0
5
5
 4
4
0
0
0
0
 1
0
0
0
0
1
4
 0
6
1
0
0
1
2
0
0
0
0
6
 5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
 3
0
4
 4
4
4
 5
1
5
5
 6
0
0
0
0
6
0
0
0
6
6
0
0
1
6
0
0
0
 0
1
1
1
1
2
 4
4
4
1
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
 3
0
3
3
3
2
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
 4
4
4
4
4
4
4
4
4
4
4
4
4
 3
3
3
3
0
3
3
3
0
3
3
0
3
3

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;

public class Code {
    public static void main(String[] args) {
        // Use the Scanner class
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n = sc.nextInt();
        int m = sc.nextInt();
        int q = sc.nextInt();

        Forest f = new Forest(n);

        while (m-- > 0) {
            int u = sc.nextInt() - 1;
            int v = sc.nextInt() - 1;
            f.F.get(u).add(v);
            f.F.get(v).add(u);
        }

       Set<Node> s =  f.get_centers();
       StringBuilder sb = new StringBuilder();
        while(q-- > 0) {
            int c = sc.nextInt();
            if (c == 2) {
                int a = sc.nextInt() - 1;
                int b = sc.nextInt() - 1;
                f.merge(a, b);
            } else {
                int a = sc.nextInt() - 1;
                sb.append(f.find_diamater(a));
                sb.append("\n");
            }
        }

        out.println(sb.toString());
    }

    static class Forest {

        UnionFind region_id;
        Map<Integer, Node> id_to_center;

        Map<Integer, Set<Integer>> F;
        Map<Integer, Integer> node_center; // map node id to the id of very first center
        Map<Integer, Node> region_center ; // map region_id to the current center

        public Forest(int n) {
            region_id = new UnionFind(n);
            id_to_center = new HashMap<>();
            F  = new HashMap<>();
            node_center  = new HashMap<>();
            region_center  = new HashMap<>();

            for (int i = 0; i < n; ++i) {
                F.put(i, new HashSet<>());
            }
        }


        Set<Node> get_centers() {
            Set<Node> centers = new  HashSet<>();
            Queue<Integer> q = new LinkedList<>();
            Map<Integer, Set<Integer>> F_CLONE = new HashMap<>();
            F.keySet().stream().filter(r -> F.get(r).size() <= 1).forEach(r ->  q.add(r));

            F.entrySet().stream().forEach(r-> F_CLONE.put(r.getKey(), new HashSet<Integer>(F.get(r.getKey()))));

            while (!q.isEmpty()) {
                int cur = q.poll();
                if (F_CLONE.get(cur).size() == 0) {
                    Node center = go(cur, -1, cur);
                    id_to_center.put(cur, center);
                    centers.add(center);
                    int reg_id = region_id.find(cur);
                    region_center.put(reg_id, center);
                }

                for (int ch : F_CLONE.get(cur)) {
                    F_CLONE.get(ch).remove(cur);
                    if (F_CLONE.get(ch).size() == 1) {
                        q.add(ch);
                    }
                }
                F_CLONE.remove(cur);
            }
            return centers;
        }

        int find_diamater(int n) {
            Node first_center = id_to_center.get(node_center.get(n));
            int reg_id = region_id.find(first_center.node_id);
            Node cur_center = region_center.get(reg_id);
            return cur_center.diameter;
        }

        void merge(int n1, int n2) {
            if (n1 == n2) {
                return;
            }
            Node c1 = id_to_center.get(node_center.get(n1));
            Node c2 = id_to_center.get(node_center.get(n2));

            if (c1 == c2) {
                return;
            }
            int reg_id_1 = region_id.find(c1.node_id);
            Node cur_center_1 = region_center.get(reg_id_1);

            int reg_id_2 = region_id.find(c2.node_id);
            Node cur_center_2 = region_center.get(reg_id_2);

            if (cur_center_1 == cur_center_2) {
                return;
            }

            Node new_center = merge_centers(cur_center_1,cur_center_2);
            region_id.unify(cur_center_1.node_id, cur_center_2.node_id);
            region_center.put(region_id.find(cur_center_1.node_id), new_center);
        }

        Node merge_centers(Node c1, Node c2) {
            int new_diam = Math.max(1 + c1.depth + c2.depth, c1.diameter);
            new_diam = Math.max(new_diam, c2.diameter);

            int new_depth = c1.depth != c2.depth ? Math.max(c1.depth, c2.depth) : 1 + c1.depth;
            int node_id = c1.depth > c2.depth ? c1.node_id : c2.node_id;
            return new Node(node_id, new_diam, new_depth);
        }

        Node go(int root, int parent_id, int center_id) {
            Node r = new Node(root, 0, 0);
            r.depth = 0;
            int largestA = Integer.MIN_VALUE, largestB = Integer.MIN_VALUE;
            for (int child : F.get(root)) {
                if (child == parent_id) continue;
                Node child_info = go(child, root, center_id);
                r.depth = Math.max(child_info.depth + 1, r.depth);
                //System.out.println("D: " + child_heights);

                if(child_info.depth > largestA) {
                    largestB = largestA;
                    largestA = child_info.depth ;
                } else if (child_info.depth  > largestB) {
                    largestB = child_info.depth ;
                }

//                if (child_heights.size() < 2) {
//                    if (child_heights.isEmpty() || Integer.compare(child_heights.peekFirst(), child_info.depth) < 0) {
//                        child_heights.addFirst(child_info.depth);
//                    } else {
//                        child_heights.addLast(child_info.depth);
//                    }
//                    continue;
//                }
//
//                if (child_heights.isEmpty() || Integer.compare(child_heights.peekFirst(), child_info.depth) < 0) {
//                    child_heights.addFirst(child_info.depth);
//                    if (child_heights.size() > 2) {
//                        child_heights.pollLast();
//                    }
//                }
//                else if (Integer.compare(child_heights.peekLast(), child_info.depth) < 0) {
//                    child_heights.pollLast();
//                    child_heights.addFirst(child_info.depth);
//                }
            }

            node_center.put(root, center_id);

            if (largestA != Integer.MIN_VALUE) {
                r.diameter += 1 + largestA;
            }
            if (largestB != Integer.MIN_VALUE) {
                r.diameter += 1 + largestB;
            }
            return r;
        }
    }




    static class Node {
        int node_id;
        int diameter;
        Integer depth;

        public Node(int id, int dia, int dep) {
            node_id = id;
            diameter = dia;
            depth = dep;
        }

        @Override
        public boolean equals(Object obj) {
            Node oth = (Node) obj;
            return  node_id == oth.node_id;
        }

        @Override
            public int hashCode() {
                // TODO Auto-generated method stub
                return Integer.valueOf(node_id).hashCode();
            }

        @Override
        public String toString() {
            return String.format("id: %d diameter: %d depth: %d", node_id, diameter, depth);
        }
    }

    static class UnionFind {

      // The number of elements in this union find
      private int size;

      // Used to track the size of each of the component
      private int[] sz;

      // id[i] points to the parent of i, if id[i] = i then i is a root node
      private int[] id;

      // Tracks the number of components in the union find
      private int numComponents;

      public UnionFind(int size) {

        if (size <= 0)
          throw new IllegalArgumentException("Size <= 0 is not allowed");

        this.size = numComponents = size;
        sz = new int[size];
        id = new int[size];

        for(int i = 0; i < size; i++) {
          id[i] = i; // Link to itself (self root)
          sz[i] = 1; // Each component is originally of size one
        }

      }

      // Find which component/set 'p' belongs to, takes amortized constant time.
      public int find(int p) {

        // Find the root of the component/set
        int root = p;
        while( root != id[root] )
          root = id[root];

        // Compress the path leading back to the root.
        // Doing this operation is called "path compression"
        // and is what gives us amortized time complexity.
        while(p != root) {
          int next = id[p];
          id[p] = root;
          p = next;
        }

        return root;

      }

      // This is an alternative recursive formulation for the find method
      // public int find(int p) {
      //   if (p == id[p]) return p;
      //   return id[p] = find(id[p]);
      // }

      // Return whether or not the elements 'p' and
      // 'q' are in the same components/set.
      public boolean connected(int p, int q) {
        return find(p) == find(q);
      }

      // Return the size of the components/set 'p' belongs to
      public int componentSize(int p) {
        return sz[find(p)];
      }

      // Return the number of elements in this UnionFind/Disjoint set
      public int size() {
        return size;
      }

      // Returns the number of remaining components/sets
      public int components() {
        return numComponents;
      }

      // Unify the components/sets containing elements 'p' and 'q'
      public void unify(int p, int q) {

        int root1 = find(p);
        int root2 = find(q);

        // These elements are already in the same group!
        if (root1 == root2) return;

        // Merge smaller component/set into the larger one.
        if (sz[root1] < sz[root2]) {
          sz[root2] += sz[root1];
          id[root1] = root2;
        } else {
          sz[root1] += sz[root2];
          id[root2] = root1;
        }

        // Since the roots found are different we know that the
        // number of components/sets has decreased by one
        numComponents--;

      }

    }


    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
       BufferedReader br;
       StringTokenizer st;

       public MyScanner() {
          br = new BufferedReader(new InputStreamReader(System.in));
       }

       String next() {
           while (st == null || !st.hasMoreElements()) {
               try {
                   st = new StringTokenizer(br.readLine());
               } catch (IOException e) {
                   e.printStackTrace();
               }
           }
           return st.nextToken();
       }

       int nextInt() {
           return Integer.parseInt(next());
       }

       long nextLong() {
           return Long.parseLong(next());
       }

       double nextDouble() {
           return Double.parseDouble(next());
       }

       String nextLine(){
           String str = "";
       try {
          str = br.readLine();
       } catch (IOException e) {
          e.printStackTrace();
       }
       return str;
       }

    }
}