#include <bits/stdc++.h>
using namespace std;
vector<int> g[300005];
int deep, vv, n, m, Q;
int f[300005], fa[300005];
int m3(int x, int y, int z) { return max(x, max(y, z)); }
int getf(int x) {
  if (fa[x] == x) return x;
  fa[x] = getf(fa[x]);
  return fa[x];
}
void dfs(int x, int last, int d) {
  if (d > deep) deep = d, vv = x;
  for (int i = 0; i < g[x].size(); i++) {
    if (g[x][i] == last) continue;
    dfs(g[x][i], x, d + 1);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
    x = getf(x);
    y = getf(y);
    if (x != y) fa[x] = y, getf(x);
  }
  for (int i = 1; i <= n; i++) {
    if (!f[getf(i)]) {
      vv = i;
      deep = 0;
      dfs(i, -1, 0);
      deep = 0;
      dfs(vv, -1, 0);
      f[getf(i)] = deep;
    }
  }
  for (int i = 1; i <= Q; i++) {
    int pp, x, y;
    scanf("%d", &pp);
    if (pp == 1) {
      scanf("%d", &x);
      printf("%d\n", f[getf(x)]);
    } else {
      scanf("%d%d", &x, &y);
      x = getf(x);
      y = getf(y);
      if (x != y) {
        int t = m3((f[x] + 1) / 2 + (f[y] + 1) / 2 + 1, f[x], f[y]);
        fa[x] = y;
        f[getf(x)] = t;
      }
    }
  }
  return 0;
}
