#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int n, m, q, d[N], f[N], cur, res;
int fir[N], to[N << 1], nxt[N << 1], cnt;
inline void addedge(int u, int v) {
  to[++cnt] = v;
  nxt[cnt] = fir[u];
  fir[u] = cnt;
}
inline int read() {
  static int x, c;
  x = 0;
  do {
    c = getchar();
  } while (!isdigit(c));
  do {
    x = (x << 3) + (x << 1) + (c & 15);
    c = getchar();
  } while (isdigit(c));
  return x;
}
int getf(int x) { return f[x] == x ? x : f[x] = getf(f[x]); }
void dfs(int u, int fa) {
  if (d[u] > d[cur]) cur = u;
  for (int i = fir[u], v; i; i = nxt[i])
    if ((v = to[i]) != fa) {
      d[v] = d[u] + 1;
      dfs(v, u);
    }
}
inline void merge(int u, int v) {
  int fu = getf(u), fv = getf(v);
  if (fu != fv) {
    f[fu] = fv;
    d[fv] = max(max(d[fv], d[fu]),
                (int)(ceil(d[fv] / 2.0) + ceil(d[fu] / 2.0) + 1));
  }
}
int main() {
  n = read(), m = read(), q = read();
  for (int i = 1; i <= n; ++i) f[i] = i;
  for (int i = 1, u, v; i <= m; ++i)
    u = read(), v = read(), addedge(u, v), addedge(v, u), f[getf(u)] = getf(v);
  for (int i = 1; i <= n; ++i)
    if (f[i] == i) {
      cur = i;
      dfs(i, 0);
      d[cur] = 0;
      res = cur;
      dfs(cur, 0);
      d[i] = d[cur];
    }
  while (q--) {
    static int u, v, op;
    scanf("%d%d", &op, &u);
    if (op == 1)
      printf("%d\n", d[getf(u)]);
    else
      scanf("%d", &v), merge(u, v);
  }
  return 0;
}
