#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 9;
vector<int> G[MAXN];
int dist[MAXN], parent[MAXN], ans[MAXN], comp[MAXN];
vector<int> store;
void dfs(int v, int par, int cmp, int flag = 0) {
  comp[v] = cmp;
  if (!flag) {
    store.push_back(v);
  }
  for (int i = 0; i < G[v].size(); i++) {
    int u = G[v][i];
    if (u == par) continue;
    dist[u] = dist[v] + 1;
    dfs(u, v, cmp, flag);
  }
}
int fp(int x) {
  if (parent[x] == x) return x;
  return parent[x] = fp(parent[x]);
}
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  while (m--) {
    int a, b;
    scanf("%d %d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  memset(dist, -1, sizeof dist);
  int cmp = 1;
  for (int i = 1; i < n + 1; i++) {
    if (dist[i] == -1) {
      store.clear();
      dist[i] = 0, dfs(i, -1, cmp);
      int maxi = 0, d = i;
      for (int j = 0; j < store.size(); j++) {
        if (dist[store[j]] > maxi) maxi = dist[store[j]], d = store[j];
      }
      dist[d] = 0, dfs(d, -1, cmp, 1);
      maxi = 0;
      for (int j = 0; j < store.size(); j++)
        if (dist[store[j]] > maxi) maxi = dist[store[j]];
      ans[cmp] = maxi;
      cmp++;
    }
  }
  for (int i = 1; i < cmp; i++) parent[i] = i;
  while (q--) {
    int a, b;
    int type;
    scanf("%d", &type);
    if (type == 1) {
      scanf("%d", &a);
      printf("%d\n", ans[fp(comp[a])]);
    } else {
      scanf("%d %d", &a, &b);
      a = comp[a], b = comp[b];
      int pa = fp(a), pb = fp(b);
      if (pa == pb) continue;
      parent[pa] = parent[pb];
      a = pa, b = pb;
      ans[a] = ans[b] =
          max(1 + (ans[a] + 1) / 2 + (ans[b] + 1) / 2, max(ans[a], ans[b]));
    }
  }
  return 0;
}
