#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 7;
const int inf = 0x3f3f3f3f;
int n, m, q;
int fa[N], dis[N], vis[N], vis1[N];
int u, v, op;
vector<int> vv[N];
int madis = -1, mapoint = 0;
int find(int x) {
  if (fa[x] != x) fa[x] = find(fa[x]);
  return fa[x];
}
void caldis(int st, int id) {
  queue<pair<int, int>> que;
  que.push({st, 0});
  if (id == 1)
    vis[st] = 1;
  else
    vis1[st] = 1;
  while (!que.empty()) {
    int tmpp = que.front().first;
    int tmpdis = que.front().second;
    que.pop();
    if (tmpdis > madis) {
      madis = tmpdis;
      mapoint = tmpp;
    }
    for (auto it : vv[tmpp]) {
      if ((!vis[it] && id == 1)) {
        vis[it] = 1;
        que.push({it, tmpdis + 1});
      } else if ((!vis1[it] && id == 2)) {
        vis1[it] = 1;
        que.push({it, tmpdis + 1});
      }
    }
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    int x = find(u);
    int y = find(v);
    if (x != y) fa[y] = x;
    vv[u].push_back(v);
    vv[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i] && fa[i] == i) {
      madis = -1;
      mapoint = -1;
      caldis(i, 1);
      caldis(mapoint, 2);
      dis[i] = madis;
    }
  }
  while (q--) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d", &u);
      u = find(u);
      printf("%d\n", dis[u]);
    } else {
      scanf("%d %d", &u, &v);
      u = find(u);
      v = find(v);
      if (u == v) {
      } else {
        int x = (dis[u] + 1) / 2 + (dis[v] + 1) / 2 + 1;
        x = max(x, max(dis[u], dis[v]));
        fa[v] = u;
        dis[u] = x;
        dis[v] = x;
      }
    }
  }
  return 0;
}
