#include <bits/stdc++.h>
using namespace std;
const int N = 501010;
const int qwq = 303030;
const int inf = 0x3f3f3f3f;
int n, m, k;
int big, id;
int len[N], vis[N];
int dep[N], fa[N];
vector<int> e[N];
inline int read() {
  int sum = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum;
}
void DFS(int u, int f) {
  vis[u] = 1;
  if (len[u] > big) big = len[u], id = u;
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (v == f) continue;
    len[v] = len[u] + 1;
    DFS(v, u);
  }
}
int find(int u) { return u == fa[u] ? u : fa[u] = find(fa[u]); }
inline void hebing(int x, int y) {
  if (x == y) return;
  dep[y] = max(max(dep[y], dep[x]), (dep[y] + 1) / 2 + (dep[x] + 1) / 2 + 1);
  fa[x] = y;
}
int main() {
  int cz, x, y;
  n = read();
  m = read();
  k = read();
  for (int i = 1; i <= n; i++) fa[i] = i;
  while (m--) {
    x = read();
    y = read();
    e[x].push_back(y);
    e[y].push_back(x);
    fa[find(x)] = find(y);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    big = id = 0;
    DFS(i, i);
    len[id] = 0;
    DFS(id, id);
    dep[find(i)] = big;
  }
  while (k--) {
    cz = read();
    x = read();
    if (cz == 2) {
      y = read();
      hebing(find(x), find(y));
    } else
      printf("%d\n", dep[find(x)]);
  }
  return 0;
}
