#include <bits/stdc++.h>
using namespace std;
struct disjoint_set {
  int *parent;
  int *rank;
  int components;
  disjoint_set(int n) {
    parent = new int[n];
    rank = new int[n];
    components = n;
    for (int i = 0; i < n; i++) {
      parent[i] = i;
      rank[i] = 0;
    }
  }
  int find(int s) { return parent[s] == s ? s : find(parent[s]); }
  bool equal(int s1, int s2) { return find(s1) == find(s2); }
  void join(int s1, int s2) {
    int p1 = find(s1);
    int p2 = find(s2);
    if (p1 == p2) return;
    if (rank[p1] == rank[p2]) ++rank[p1];
    if (rank[p1] < rank[p2]) swap(p1, p2);
    parent[p2] = p1;
    --components;
  }
};
int n, m;
disjoint_set ds(300005);
vector<int> adj[300005];
bool vis[300005];
int dist[300005];
int arr[300005];
int per[300005];
int getPrim(int st) {
  queue<int> q;
  q.push(st);
  int lstNode = st;
  while (!q.empty()) {
    int v = q.front();
    vis[v] = 1;
    q.pop();
    lstNode = v;
    for (int i = 0; i < adj[v].size(); i++) {
      int u = adj[v][i];
      if (!vis[u]) {
        ds.join(st, u);
        q.push(u);
      }
    }
  }
  dist[lstNode] = 0;
  per[lstNode] = -1;
  q.push(lstNode);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    lstNode = v;
    for (int i = 0; i < adj[v].size(); i++) {
      int u = adj[v][i];
      if (per[v] != u) {
        per[u] = v;
        dist[u] = dist[v] + 1;
        q.push(u);
      }
    }
  }
  return dist[lstNode];
}
int main() {
  memset(dist, 0, sizeof dist);
  memset(arr, 0, sizeof arr);
  int q, a, b;
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    a--;
    b--;
    adj[b].push_back(a);
    adj[a].push_back(b);
  }
  for (int i = 0; i < n; i++)
    if (!vis[i]) {
      int num = getPrim(i);
      arr[ds.find(i)] = num;
    }
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &a, &b);
    b--;
    if (a == 1)
      printf("%d\n", arr[ds.find(b)]);
    else {
      scanf("%d", &a);
      a--;
      if (!ds.equal(a, b)) {
        int d1 = arr[ds.find(a)];
        int d2 = arr[ds.find(b)];
        int mx = max(d1, d2);
        d1++;
        d2++;
        ds.join(a, b);
        arr[ds.find(a)] = max(d1 / 2 + d2 / 2 + 1, mx);
      }
    }
  }
}
