#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
int n, m, Q, fa[300001], d[300001], fir[300001], cmp, dep[300001];
bool vis[300001];
struct node {
  int to, nxt;
} e[600001];
void cr(int u, int v) {
  e[++cmp] = {v, fir[u]};
  fir[u] = cmp;
}
void dfs(int x, int top) {
  fa[x] = top;
  vis[x] = true;
  for (int i = fir[x]; i; i = e[i].nxt) {
    int tt = e[i].to;
    if (vis[tt]) continue;
    dfs(tt, top);
    d[top] = max(d[top], dep[x] + dep[tt] + 1);
    dep[x] = max(dep[x], dep[tt] + 1);
  }
}
int gr(int x) {
  if (fa[x] == x) return x;
  return fa[x] = gr(fa[x]);
}
void uni(int u, int v) {
  if (gr(u) == gr(v)) return;
  int d1 = d[gr(u)], d2 = d[gr(v)];
  int d3 = (d1 + 1) / 2 + (d2 + 1) / 2 + 1;
  fa[gr(u)] = gr(v);
  int g = gr(v);
  d[g] = max(max(d1, d2), d3);
}
int main() {
  cin >> n >> m >> Q;
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int u, v;
    u = read();
    v = read();
    cr(u, v);
    cr(v, u);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    dfs(i, i);
  }
  while (Q--) {
    int p, q;
    p = read();
    if (p == 1) {
      p = read();
      cout << d[gr(p)] << endl;
      continue;
    }
    p = read();
    q = read();
    if (gr(p) == gr(q)) continue;
    uni(p, q);
  }
  return 0;
}
