#include <bits/stdc++.h>
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
using namespace std;
int n, m, q;
int pr[300005], D[300005];
bool vis[300005];
bool visited[300005];
vector<int> G[300005];
int find(int r) {
  if (pr[r] == r)
    return r;
  else
    return pr[r] = find(pr[r]);
}
int most, dia;
void dfs1(int node, int dis) {
  if (vis[node]) return;
  vis[node] = 1;
  visited[node] = 1;
  if (dis > dia) {
    dia = dis;
    most = node;
  }
  for (int i = 0; i < G[node].size(); i++) {
    dfs1(G[node][i], dis + 1);
  }
  vis[node] = 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) pr[i] = i;
  while (m--) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
    int u = find(a);
    int v = find(b);
    if (u != v) pr[v] = u;
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      dia = -1;
      dfs1(i, 0);
      dia = -1;
      dfs1(most, 0);
      D[find(i)] = dia;
    }
  }
  while (q--) {
    int ch;
    cin >> ch;
    if (ch == 1) {
      int x;
      cin >> x;
      int u = find(x);
      cout << D[u] << "\n";
    } else {
      int a, b;
      cin >> a >> b;
      int u = find(a);
      int v = find(b);
      if (u != v) {
        D[u] = max(D[u], max(D[v], (D[u] + 1) / 2 + (D[v] + 1) / 2 + 1));
        pr[v] = u;
      }
    }
  }
}
