#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e6 + 10;
int n, m, q, fa[maxn], maxx, dis[maxn], st;
int cnt, head[maxn], to[maxn << 1], nxt[maxn << 1];
bool vis[maxn], vis2[maxn];
int read() {
  int ret = 0, f = 1;
  char x = getchar();
  while (!isdigit(x)) {
    if (x == '-') f = -1;
    x = getchar();
  }
  while (isdigit(x)) {
    ret = ret * 10 + x - '0';
    x = getchar();
  }
  return ret * f;
}
void add_edge(int x, int y) {
  cnt++;
  to[cnt] = y;
  nxt[cnt] = head[x];
  head[x] = cnt;
}
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void merge(int x, int y) {
  int xx = find(x), yy = find(y);
  fa[xx] = yy;
}
void dfs(int x, int val) {
  if (maxx < val) maxx = val, st = x;
  for (int i = head[x]; i; i = nxt[i]) {
    int v = to[i];
    if (!vis[v]) {
      vis[v] = true;
      dfs(v, val + 1);
    }
  }
  vis[x] = false;
}
void dfs2(int x, int val) {
  if (maxx < val) maxx = val;
  for (int i = head[x]; i; i = nxt[i]) {
    int v = to[i];
    if (!vis[v]) {
      vis[v] = true;
      dfs2(v, val + 1);
    }
  }
  vis[x] = false;
}
int main() {
  n = read(), m = read(), q = read();
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    add_edge(x, y), add_edge(y, x);
    merge(x, y);
  }
  for (int i = 1; i <= n; i++) {
    int x = find(i);
    if (vis2[x]) continue;
    maxx = -1;
    vis[x] = true;
    dfs(x, 0);
    maxx = -1;
    vis[st] = true;
    dfs2(st, 0);
    vis2[x] = true;
    dis[x] = maxx;
  }
  for (int i = 1; i <= q; i++) {
    int opt = read(), x = read();
    if (opt == 1)
      printf("%d\n", dis[find(x)]);
    else {
      int y = read();
      int fx = find(x), fy = find(y);
      if (fx == fy) continue;
      dis[fy] =
          max(max((dis[fx] + 1) / 2 + (dis[fy] + 1) / 2 + 1, dis[fx]), dis[fy]);
      merge(x, y);
    }
  }
}
