#include <bits/stdc++.h>
using namespace std;
int read() {
  int n = 0;
  bool b = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') b = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    n = (n << 1) + (n << 3) + (c ^ 48);
    c = getchar();
  }
  return b ? -n : n;
}
const int N = 3e6 + 7;
struct node {
  int to, next;
} e[N << 1];
int cnt, head[N];
int fa[N], res, t, dis[N];
bool vis[N], vis2[N];
inline void add(int u, int v) {
  e[++cnt].to = v;
  e[cnt].next = head[u];
  head[u] = cnt;
}
inline int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
inline void merge(int x, int y) {
  int fx = find(x), fy = find(y);
  fa[fx] = fy;
}
inline void dfs(int x, int val) {
  if (res < val) res = val, t = x;
  for (int i = head[x]; i; i = e[i].next) {
    int v = e[i].to;
    if (!vis[v]) vis[v] = 1, dfs(v, val + 1);
  }
  vis[x] = 0;
}
inline void dfs2(int x, int val) {
  if (res < val) res = val;
  for (int i = head[x]; i; i = e[i].next) {
    int v = e[i].to;
    if (!vis[v]) {
      vis[v] = 1;
      dfs2(v, val + 1);
    }
  }
  vis[x] = 0;
}
int main() {
  int 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(x, y);
    add(y, x);
    merge(x, y);
  }
  for (int i = 1; i <= n; i++) {
    int x = find(i);
    if (vis2[x]) continue;
    res = -1;
    vis[x] = 1;
    dfs(x, 0);
    res = -1;
    vis[t] = 1;
    dfs2(t, 0);
    vis2[x] = 1;
    dis[x] = res;
  }
  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);
    }
  }
  return 0;
}
