#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int i, j, k, n, m, root[N], x, lp[N], y, q, t1, t2, h[N], mx, mxnode;
vector<int> v[N];
void dfs(int x, int s, int t) {
  if (s > mx) {
    mx = s;
    mxnode = x;
  }
  h[x] = t;
  root[x] = i;
  for (int j = 0; j < v[x].size(); j++) {
    if (h[v[x][j]] != t) {
      h[v[x][j]] = t;
      dfs(v[x][j], s + 1, t);
    }
  }
}
int dsu(int x) {
  if (root[x] == x) return x;
  return root[x] = dsu(root[x]);
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (root[i]) continue;
    mx = -1;
    dfs(i, 0, 1);
    mx = -1;
    dfs(mxnode, 0, 2);
    lp[i] = mx;
  }
  for (i = 0; i < k; i++) {
    scanf("%d %d", &q, &x);
    if (q == 1) {
      printf("%d\n", lp[dsu(x)]);
      continue;
    }
    scanf("%d", &y);
    t1 = dsu(x);
    t2 = dsu(y);
    if (t1 == t2) continue;
    lp[t1] = max(max(lp[t1], lp[t2]), (lp[t1] + 1) / 2 + (lp[t2] + 1) / 2 + 1);
    root[t2] = t1;
  }
  return 0;
}
