#include <bits/stdc++.h>
const int maxn = 300005;
struct Edges {
  int next, to;
} e[maxn << 1];
int head[maxn], tot;
int fa[maxn], size[maxn];
int pos, maxd;
int len[maxn];
int n, m, q;
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
void link(int u, int v) {
  e[++tot] = (Edges){head[u], v};
  head[u] = tot;
}
void dfs(int u, int f, int dep) {
  if (dep > maxd) {
    maxd = dep;
    pos = u;
  }
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (v == f) continue;
    dfs(v, u, dep + 1);
  }
}
int get_diameter(int s) {
  pos = -1, maxd = -1;
  dfs(s, 0, 0);
  int sb = pos;
  pos = -1, maxd = -1;
  dfs(sb, 0, 0);
  return maxd;
}
int rad(int x) { return (len[x] + 1) / 2; }
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) fa[i] = i, size[i] = 1;
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    link(u, v);
    link(v, u);
    int uu = find(u), vv = find(v);
    if (uu == vv) continue;
    if (size[uu] < size[vv]) std::swap(uu, vv);
    fa[vv] = uu;
    size[uu] += size[vv];
  }
  for (int i = 1; i <= n; i++) {
    if (find(i) == i) len[i] = get_diameter(i);
  }
  while (q--) {
    int opt, x, y;
    scanf("%d", &opt);
    if (opt == 1) {
      scanf("%d", &x);
      printf("%d\n", len[find(x)]);
    } else if (opt == 2) {
      scanf("%d%d", &x, &y);
      int uu = find(x), vv = find(y);
      if (uu == vv) continue;
      if (size[uu] < size[vv]) std::swap(uu, vv);
      fa[vv] = uu;
      size[uu] += size[vv];
      len[uu] = std::max(len[uu], std::max(len[vv], rad(uu) + rad(vv) + 1));
    }
  }
  return 0;
}
