#include <bits/stdc++.h>
using namespace std;
int p[300005], far, dist;
pair<int, int> d[300005];
vector<int> G[300005];
void dfs(int v, int fat, int c, int distance = 0) {
  p[v] = c;
  if (distance > dist) dist = distance, far = v;
  for (int x : G[v])
    if (x != fat) dfs(x, v, c, distance + 1);
}
int findp(int a) {
  if (p[a] == a) return a;
  return p[a] = findp(p[a]);
}
void mergep(int a, int b) {
  int x = findp(a), y = findp(b);
  p[x] = y;
  if (d[y].first + d[y].second == d[x].first + d[x].second)
    d[y] = {d[x].second + 1, d[y].second};
  else if (d[y].first + d[y].second > d[x].first + d[x].second) {
    if (d[x].second + 1 >= d[y].first) d[y] = {d[x].second + 1, d[y].second};
  } else {
    if (d[y].second + 1 >= d[x].first)
      d[y] = {d[y].second + 1, d[x].second};
    else
      d[y] = d[x];
  }
  if (d[y].first > d[y].second) swap(d[y].first, d[y].second);
}
int main() {
  int n, m, q, a, b, op;
  scanf("%d%d%d", &n, &m, &q);
  while (m--) {
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!p[i]) {
      dist = -1;
      dfs(i, i, i);
      dist = -1;
      dfs(far, far, i);
      d[i] = {dist / 2, (dist + 1) / 2};
    }
  }
  while (q--) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d", &a);
      auto leaves = d[findp(a)];
      printf("%d\n", leaves.first + leaves.second);
    } else {
      scanf("%d%d", &a, &b);
      if (findp(a) != findp(b)) mergep(a, b);
    }
  }
  return 0;
}
