#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int sz = 3e5 + 10;
int par[sz], dia[sz], vis[sz];
vector<int> G[sz], vec;
int find(int x) {
  if (par[x] == x) return x;
  return par[x] = find(par[x]);
}
void uni(int x, int y) {
  if ((x = find(x)) == (y = find(y))) return;
  int d1 = dia[x] + 1;
  d1 /= 2;
  int d2 = dia[y] + 1;
  d2 /= 2;
  dia[x] = max(d1 + d2 + 1, dia[x]);
  dia[x] = max(dia[x], dia[y]);
  par[y] = x;
}
pii dfs(int u, int p) {
  pii ret = {u, 0};
  pii hand;
  vec.push_back(u);
  vis[u] = 1;
  for (int v : G[u]) {
    if (v == p) continue;
    hand = dfs(v, u);
    if (ret.second < hand.second) ret = hand;
  }
  ret.second++;
  return ret;
}
void _do(int u) {
  pii x = dfs(u, -1);
  pii y = dfs(x.first, -1);
  for (int v : vec) par[v] = u;
  dia[u] = y.second - 1;
  vec.clear();
}
int main() {
  int n, m, q, ty, x, y;
  while (~scanf("%d %d %d", &n, &m, &q)) {
    for (int i = 0; i <= n; i++) {
      par[i] = i;
      dia[sz] = 0;
      vis[i] = 0;
    }
    for (int i = 0; i < m; i++) {
      scanf("%d %d", &x, &y);
      G[x].push_back(y);
      G[y].push_back(x);
    }
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) _do(i);
    }
    while (q--) {
      scanf("%d", &ty);
      if (ty == 1) {
        scanf("%d", &x);
        printf("%d\n", dia[find(x)]);
      } else {
        scanf("%d %d", &x, &y);
        uni(x, y);
      }
    }
  }
  return 0;
}
