#include <bits/stdc++.h>
using namespace std;
int n, m, q;
vector<int> graph[300005], yo;
bool done[300005] = {0}, done2[300005] = {0};
int parent[300005], ans[300005] = {0}, dp[300005][2];
int get(int x) {
  while (x != parent[x]) x = parent[x];
  return x;
}
void merge(int x, int y) {
  int cntx = 0, cnty = 0;
  while (x != parent[x]) x = parent[x], cntx++;
  while (y != parent[y]) y = parent[y], cnty++;
  if (cntx < cnty)
    parent[x] = y;
  else
    parent[y] = x;
}
int go(int src) {
  pair<int, int> maxx = {src, 0};
  stack<pair<int, int> > s;
  s.push({src, 0});
  while (!s.empty()) {
    int x = s.top().first, d = s.top().second;
    if (d > maxx.second) maxx = {x, d};
    s.pop();
    done2[x] = 1;
    for (auto it : graph[x])
      if (!done2[it]) s.push({it, d + 1});
  }
  s.push({maxx.first, 0});
  maxx.second = 0;
  while (!s.empty()) {
    int x = s.top().first, d = s.top().second;
    if (d > maxx.second) maxx = {x, d};
    s.pop();
    done[x] = 1;
    yo.push_back(x);
    for (auto it : graph[x])
      if (!done[it]) s.push({it, d + 1});
  }
  return maxx.second;
}
int main() {
  for (__typeof(300005) i = 0 - (0 > 300005); i != 300005 - (0 > 300005);
       i += 1 - 2 * (0 > 300005))
    parent[i] = i;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &q);
  for (__typeof(m) i = 0 - (0 > m); i != m - (0 > m); i += 1 - 2 * (0 > m)) {
    int u, v;
    scanf("%d", &u);
    scanf("%d", &v);
    graph[u].push_back(v);
    graph[v].push_back(u);
    merge(u, v);
  }
  for (__typeof(n + 1) i = 1 - (1 > n + 1); i != n + 1 - (1 > n + 1);
       i += 1 - 2 * (1 > n + 1)) {
    if (!done[i]) {
      yo.clear();
      int dia = go(i);
      for (auto it : yo) ans[it] = dia;
    }
  }
  for (__typeof(q) i = 0 - (0 > q); i != q - (0 > q); i += 1 - 2 * (0 > q)) {
    int mode;
    scanf("%d", &mode);
    if (mode == 1) {
      int x;
      scanf("%d", &x);
      printf("%d\n", ans[get(x)]);
    } else {
      int x, y;
      scanf("%d", &x);
      scanf("%d", &y);
      if (get(x) == get(y)) continue;
      int a = ans[get(x)], b = ans[get(y)], c = (a + 1) / 2 + (b + 1) / 2 + 1;
      merge(x, y);
      ans[get(x)] = max(c, max(a, b));
    }
  }
  return 0;
}
