#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 3e5 + 10;
int par[N_MAX], rnk[N_MAX], dia[N_MAX];
vector<int> gra[N_MAX];
void init(const int &n) {
  for (int i = 1; i <= n; i++) {
    par[i] = i;
    dia[i] = rnk[i] = 0;
  }
  return;
}
int find(const int &x) {
  if (par[x] == x) return x;
  return par[x] = find(par[x]);
}
void unite(const int &a, const int &b) {
  if (rnk[a] > rnk[b])
    par[b] = a;
  else {
    par[a] = b;
    if (rnk[a] == rnk[b]) rnk[b]++;
  }
}
int dep[N_MAX];
int dfs(const int &v, const int &last) {
  int ret = v;
  for (int u : gra[v]) {
    if (u == last) continue;
    dep[u] = dep[v] + 1;
    int tmp = dfs(u, v);
    if (dep[tmp] > dep[ret]) ret = tmp;
  }
  return ret;
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  init(n);
  for (int i = 0; i < m; i++) {
    int st, ed;
    scanf("%d%d", &st, &ed);
    gra[st].push_back(ed), gra[ed].push_back(st);
    st = find(st), ed = find(ed);
    unite(st, ed);
  }
  for (int i = 1; i <= n; i++) {
    int v = find(i);
    if (dia[v] == 0) {
      dep[v] = 0;
      int tmp = dfs(v, v);
      dep[tmp] = 0;
      dia[v] = dep[dfs(tmp, tmp)];
    }
  }
  while (q--) {
    int id;
    scanf("%d", &id);
    if (id == 1) {
      int v;
      scanf("%d", &v);
      printf("%d\n", dia[find(v)]);
    } else {
      int a, b;
      scanf("%d%d", &a, &b);
      a = find(a), b = find(b);
      if (a != b) {
        unite(a, b);
        dia[a] = dia[b] =
            max(max(dia[a], dia[b]), (dia[a] + 1) / 2 + (dia[b] + 1) / 2 + 1);
      }
    }
  }
  return 0;
}
