#include <bits/stdc++.h>
using namespace std;
int fa[300005], d[300005], dist[300005], vis[3][300005], ffff[300005];
int n, m, q, tot;
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while ('0' <= c && c <= '9') {
    x = (x << 1) + (x << 3) + c - 48;
    c = getchar();
  }
  return x;
}
int findfa(int x) {
  if (fa[x] == x) return x;
  return fa[x] = findfa(fa[x]);
}
void merge(int x, int y) {
  int fx = findfa(x);
  int fy = findfa(y);
  if (fx == fy) return;
  fa[fx] = fy;
  d[fy] = max(d[fx], max(d[fy], ((d[fx] + 1) >> 1) + ((d[fy] + 1) >> 1) + 1));
}
struct tree {
  int v;
  tree *next;
} * h[300005], pool[600010];
void addedge(int u, int v) {
  tot++;
  tree *p = &pool[tot];
  p->v = v;
  p->next = h[u];
  h[u] = p;
}
void dfs(int ty, int u, int len) {
  if (vis[ty][u]) return;
  vis[ty][u] = 1;
  int flag = 0;
  for (tree *p = h[u]; p; p = p->next) {
    if (vis[ty][p->v] == 0) flag = 1;
    dfs(ty, p->v, len + 1);
  }
  if (flag) return;
  if (ty == 2 && len > d[findfa(u)])
    d[findfa(u)] = len;
  else if (ty == 1 && len > d[findfa(u)])
    d[findfa(u)] = len, ffff[findfa(u)] = u;
}
void pre() {
  for (int i = 1; i <= n; i++) {
    dfs(1, i, 0);
    dfs(2, ffff[findfa(i)], 0);
  }
}
int main() {
  n = read();
  m = read();
  q = read();
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1, u, v, fu, fv; i <= m; i++) {
    u = read();
    v = read();
    addedge(u, v);
    addedge(v, u);
    fu = findfa(u);
    fv = findfa(v);
    fa[fu] = fv;
  }
  pre();
  for (int i = 1, u, v, w; i <= q; i++) {
    u = read();
    if (u == 1) {
      v = read();
      printf("%d\n", d[findfa(v)]);
    }
    if (u == 2) {
      v = read();
      w = read();
      merge(v, w);
    }
  }
  return 0;
}
