#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
long long n, m, q;
vector<long long> e[300010];
long long fa[300010];
long long find(long long x) {
  if (fa[x] == x)
    return x;
  else
    return fa[x] = find(fa[x]);
}
void upd(long long x, long long y) {
  long long xx = find(x), yy = find(y);
  if (xx == yy) return;
  fa[xx] = yy;
}
bool fl[300010];
long long dem[300010];
long long far, len;
void dfs(long long u, long long fa, long long num) {
  fl[u] = 1;
  long long tmp = 0;
  for (int i = 0; i < e[u].size(); i++)
    if (e[u][i] != fa) {
      long long v = e[u][i];
      dfs(v, u, num + 1);
      tmp++;
    }
  if (!tmp && num > len) len = num, far = u;
}
int main() {
  n = rd(), m = rd(), q = rd();
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    long long u = rd(), v = rd();
    e[u].push_back(v);
    e[v].push_back(u);
    upd(u, v);
  }
  for (int i = 1; i <= n; i++)
    if (!fl[i]) {
      far = len = 0;
      dfs(i, 0, 0);
      len = 0;
      dfs(far, 0, 0);
      dem[find(i)] = len;
    }
  while (q--) {
    long long opt = rd();
    if (opt == 1) {
      long long x = rd();
      printf("%lld\n", dem[find(x)]);
    } else {
      long long x = rd(), y = rd();
      long long xx = find(x), yy = find(y);
      if (xx == yy) continue;
      fa[xx] = yy;
      dem[yy] =
          max(max(dem[xx], dem[yy]), (dem[xx] + 1) / 2 + (dem[yy] + 1) / 2 + 1);
    }
  }
  return 0;
}
