#include <bits/stdc++.h>
using namespace std;
int dia[300300], p[300300], visited[300300];
vector<int> adj[300300];
void init() {
  for (int i = 0; i < 300300; ++i) dia[i] = 0, p[i] = i;
}
int findset(int u) {
  if (p[u] == u) return u;
  p[u] = findset(p[u]);
  return p[u];
}
void merge(int u, int v) {
  u = findset(u), v = findset(v);
  if (u == v) return;
  dia[u] = max((dia[u] + 1) / 2 + (dia[v] + 1) / 2 + 1, max(dia[u], dia[v]));
  p[v] = u;
}
pair<int, int> dfs(int u, int c, int par) {
  p[u] = c;
  visited[u] = 1;
  int mx = -1, smx = -1, dia = 0;
  for (auto it : adj[u]) {
    if (it != par) {
      auto a = dfs(it, c, u);
      dia = max(dia, a.first);
      if (a.second >= mx)
        smx = mx, mx = a.second;
      else if (a.second > smx)
        smx = a.second;
    }
  }
  dia = max(dia, mx + smx + 2);
  return {dia, mx + 1};
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  init();
  int n, m, q, u, v;
  cin >> n >> m >> q;
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; ++i) {
    if (!visited[i + 1]) {
      auto a = dfs(i + 1, i + 1, -1);
      dia[i + 1] = a.first;
    }
  }
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      cin >> u;
      cout << dia[findset(u)] << endl;
    } else {
      cin >> u >> v;
      merge(u, v);
    }
  }
  return 0;
}
