#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010;
int n, m, q, maxid, maxdis;
int pre[maxn], vis[maxn], dis[maxn];
vector<int> g[maxn];
void dfs(int u, int fa, int d, int r) {
  pre[u] = r;
  if (d > maxdis) {
    maxdis = d;
    maxid = u;
  }
  for (int i = 0; i < g[u].size(); i++)
    if (g[u][i] != fa) dfs(g[u][i], u, d + 1, r);
}
int find(int x) {
  if (x == pre[x]) return x;
  return pre[x] = find(pre[x]);
}
void unite(int a, int b) {
  int x = find(a), y = find(b);
  if (x == y) return;
  if (dis[x] < dis[y]) swap(dis[x], dis[y]);
  pre[y] = x;
  int tmp = 0;
  dis[x] = max(dis[x], (dis[x] + 1) / 2 + (dis[y] + 1) / 2 + 1);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) pre[i] = i;
  memset(dis, 0, sizeof(dis));
  for (int i = 1; i <= n; i++)
    if (pre[i] == i) {
      maxdis = -1;
      maxid = i;
      dfs(i, 0, 0, i);
      maxdis = -1;
      dfs(maxid, 0, 0, i);
      dis[find(i)] = maxdis;
    }
  while (q--) {
    int op, x, y;
    scanf("%d%d", &op, &x);
    if (op == 1)
      printf("%d\n", dis[find(x)]);
    else {
      scanf("%d", &y);
      unite(x, y);
    }
  }
  return 0;
}
