#include <bits/stdc++.h>
using namespace std;
vector<int> E[300010];
int ans[300010];
int p[300010];
inline int find(int a) {
  if (p[a] == a) return a;
  p[a] = find(p[a]);
  return p[a];
}
inline void _union(int a, int b) {
  p[find(a)] = find(b);
  find(a);
}
int depth;
int v;
inline void dfs(int u, int last, int d) {
  if (d > depth) {
    depth = d;
    v = u;
  }
  for (int i = 0; i < E[u].size(); i++) {
    if (E[u][i] == last) continue;
    dfs(E[u][i], u, d + 1);
  }
}
int main() {
  int n, m, q;
  while (cin >> n >> m >> q) {
    for (int i = 1; i <= n; i++) p[i] = i;
    for (int i = 1; i <= m; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      E[u].push_back(v);
      E[v].push_back(u);
      if (find(u) != find(v)) _union(u, v);
    }
    for (int i = 1; i <= n; i++) {
      if (!ans[find(i)]) {
        v = i;
        depth = 0;
        dfs(i, -1, 0);
        depth = 0;
        dfs(v, -1, 0);
        ans[find(i)] = depth;
      }
    }
    for (int i = 1; i <= q; i++) {
      int type;
      scanf("%d", &type);
      if (type == 2) {
        int u, v;
        scanf("%d%d", &u, &v);
        if (find(u) != find(v)) {
          int tmp = max((ans[find(u)] + 1) / 2 + (ans[find(v)] + 1) / 2 + 1,
                        max(ans[find(u)], ans[find(v)]));
          _union(u, v);
          ans[find(u)] = tmp;
        }
      } else {
        int u;
        scanf("%d", &u);
        printf("%d\n", ans[find(u)]);
      }
    }
  }
  return 0;
}
