#include <bits/stdc++.h>
using namespace std;
const int N = 300003;
int parent[N], diameter[N];
vector<vector<int> > adjList(N);
bool vis[N];
void build(int n) {
  for (int i = 1; i <= n; i++) parent[i] = i;
}
int findParent(int x) {
  if (x == parent[x]) return x;
  return parent[x] = findParent(parent[x]);
}
void mergeSet(int x, int y) {
  int px = findParent(x), py = findParent(y);
  if (px == py) return;
  parent[px] = py;
  diameter[px] = diameter[py] =
      max((diameter[px] + 1) / 2 + (diameter[py] + 1) / 2 + 1,
          max(diameter[px], diameter[py]));
}
int dfs(int node) {
  vis[node] = true;
  int maxi = 0, secondMaxi = 0;
  for (int ch : adjList[node]) {
    if (!vis[ch]) {
      int x = dfs(ch);
      if (x + 1 >= maxi)
        secondMaxi = maxi, maxi = x + 1;
      else if (x + 1 > secondMaxi)
        secondMaxi = x + 1;
    }
  }
  int p = findParent(node);
  diameter[p] = max(diameter[p], maxi + secondMaxi);
  return maxi;
}
int main() {
  int n, m, q, x, y;
  scanf("%d %d %d", &n, &m, &q);
  build(n);
  while (m--) {
    scanf("%d %d", &x, &y);
    adjList[x].push_back(y);
    adjList[y].push_back(x);
    mergeSet(x, y);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i);
  }
  while (q--) {
    scanf("%d", &x);
    if (x == 1) {
      scanf("%d", &y);
      printf("%d\n", diameter[findParent(y)]);
    } else {
      scanf("%d %d", &x, &y);
      if (findParent(x) != findParent(y)) mergeSet(x, y);
    }
  }
  return 0;
}
