#include <bits/stdc++.h>
using namespace std;
int n, m, k, q;
int p[300010];
vector<int> vec[300100];
bool vst[300010];
bool rvst[300010];
int h = 0, node;
int length[300010];
int find(int a) {
  if (a == p[a]) return p[a];
  return p[a] = find(p[a]);
}
void merge(int a, int b) {
  int na = find(p[a]);
  int nb = find(p[b]);
  p[nb] = p[na];
  return;
}
void dfs(int cur, int lv) {
  vst[cur] = true;
  if (vec[cur].size() == 1) {
    if (h < lv) {
      h = lv;
      node = cur;
    }
  }
  for (auto& it : vec[cur]) {
    if (!vst[it]) dfs(it, lv + 1);
  }
  return;
}
int rdfs(int cur) {
  int lv = 0;
  rvst[cur] = true;
  for (auto& it : vec[cur]) {
    if (!rvst[it]) lv = max(lv, rdfs(it) + 1);
  }
  return lv;
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i <= n; i++) p[i] = i;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    vec[a].push_back(b);
    vec[b].push_back(a);
    merge(a, b);
  }
  for (int i = 1; i <= n; i++) {
    h = 0;
    if (!vst[i]) {
      dfs(i, 0);
      length[find(i)] = rdfs(node);
    }
  }
  for (int i = 0; i < q; i++) {
    int a, b, c;
    scanf("%d", &a);
    if (a == 2) {
      scanf("%d %d", &b, &c);
      if (p[find(b)] == p[find(c)]) continue;
      int lb = length[find(b)], lc = length[find(c)], tempb, tempc;
      if (lb < lc) {
        swap(lb, lc);
        swap(b, c);
      }
      if (lb % 2)
        tempb = lb / 2 + 1;
      else
        tempb = lb / 2;
      if (lc % 2)
        tempc = lc / 2 + 1;
      else
        tempc = lc / 2;
      if (tempc + tempb + 1 > max(lb, lc)) {
        length[p[b]] = tempc + tempb + 1;
      }
      merge(b, c);
    } else {
      scanf("%d", &b);
      printf("%d\n", length[find(b)]);
    }
  }
  return 0;
}
