#include <bits/stdc++.h>
using namespace std;
int n, m, q;
const int MAXN = 300005;
int father[MAXN], Rank[MAXN], l[MAXN];
int deep[MAXN];
vector<int> G[MAXN];
int find_set(int x) {
  if (father[x] != x) {
    father[x] = find_set(father[x]);
  }
  return father[x];
}
void Union(int x, int y) {
  x = find_set(x);
  y = find_set(y);
  if (x != y) {
    if (Rank[x] > Rank[y])
      father[y] = x;
    else if (Rank[x] < Rank[y])
      father[x] = y;
    else {
      father[y] = x;
      Rank[x]++;
    }
  }
}
void initial() {
  for (int i = 1; i <= n; i++) {
    father[i] = i;
    Rank[i] = 0;
  }
  int x, y;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    Union(x, y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
}
int INF = 1e9;
void init_dfs(int u) {
  deep[u] = INF;
  for (int i = 0; i < G[u].size(); i++)
    if (deep[G[u][i]] != INF) init_dfs(G[u][i]);
}
int bfs(int u) {
  init_dfs(u);
  int rt = u;
  deep[u] = 0;
  queue<int> q;
  q.push(u);
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    if (deep[rt] < deep[t]) rt = t;
    for (int i = 0; i < G[t].size(); i++)
      if (deep[G[t][i]] > deep[t] + 1) {
        deep[G[t][i]] = deep[t] + 1;
        q.push(G[t][i]);
      }
  }
  l[find_set(u)] = deep[rt];
  return rt;
}
int main() {
  cin >> n >> m >> q;
  initial();
  for (int i = 1; i <= n; i++)
    if (find_set(i) == i) {
      int t = bfs(i);
      bfs(t);
    }
  while (q--) {
    int t, x, y;
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &x);
      printf("%d\n", l[find_set(x)]);
    } else {
      scanf("%d %d", &x, &y);
      x = find_set(x);
      y = find_set(y);
      if (x != y) {
        father[y] = x;
        l[x] = max(max(l[x], l[y]), (l[x] + 1) / 2 + (l[y] + 1) / 2 + 1);
      }
    }
  }
  return 0;
}
