#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
vector<int> ok[N];
int par[N], sv[N], mx = -1, last = 0;
int vis[N];
int go(int u) {
  if (par[u] == u) return u;
  return par[u] = go(par[u]);
}
void dfs(int u, int v, int cost) {
  vis[u] = 1;
  if (cost > mx) {
    mx = cost;
    last = u;
  }
  for (int i = 0; i < ok[u].size(); i++)
    if (ok[u][i] != v) dfs(ok[u][i], u, cost + 1);
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) par[i] = i;
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    ok[a].push_back(b);
    ok[b].push_back(a);
    int na = go(a), nb = go(b);
    par[nb] = na;
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      mx = -1;
      dfs(i, -1, 0);
      mx = -1;
      dfs(last, -1, 0);
      sv[go(i)] = mx;
    }
  }
  while (q--) {
    int x, a, b;
    scanf("%d", &x);
    if (x & 1) {
      scanf("%d", &a);
      printf("%d\n", sv[go(a)]);
    } else {
      scanf("%d%d", &a, &b);
      int na = go(a), nb = go(b);
      if (na == nb) continue;
      int x = sv[na];
      int y = sv[nb];
      int z = (x + (x & 1)) / 2 + (y + (y & 1)) / 2 + 1;
      sv[na] = max(x, max(y, z));
      par[nb] = na;
    }
  }
  return 0;
}
