#include <bits/stdc++.h>
using namespace std;
long long int key[300005], dia[300005], m1[300005], m2[300005], dp1[300005],
    dp2[300005];
vector<long long int> kv[300005], adj[300005];
bool mrk[300005];
inline void dfs(long long int x, long long int pr, long long int root) {
  if (mrk[x]) return;
  mrk[x] = 1;
  key[x] = root;
  if (x != root) kv[root].push_back(x);
  for (auto j : adj[x]) {
    if (j == pr) continue;
    if (mrk[j]) continue;
    dfs(j, x, root);
    if (dp1[j] >= m1[x]) {
      m2[x] = m1[x];
      m1[x] = dp1[j];
    } else if (dp1[j] >= m2[x])
      m2[x] = dp1[j];
  }
  dp1[x] = m1[x] + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, m, q;
  cin >> n >> m >> q;
  for (long long int i = 1; i <= n; i++) {
    m1[i] = m2[i] = -1;
    key[i] = i;
    kv[i].push_back(i);
  }
  for (long long int i = 0; i < m; i++) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (long long int i = 1; i <= n; i++) {
    if (!mrk[i]) dfs(i, -1, i);
  }
  long long int mx = 0;
  for (long long int i = 1; i <= n; i++) {
    dp2[i] = m1[i] + m2[i] + 2;
    mx = max(dp1[i], dp2[i]);
    dia[key[i]] = max(dia[key[i]], mx);
  }
  while (q--) {
    long long int ch;
    cin >> ch;
    if (ch == 1) {
      long long int x;
      cin >> x;
      cout << dia[key[x]] << '\n';
      continue;
    }
    long long int x, y;
    cin >> x >> y;
    if (key[x] != key[y]) {
      if (kv[key[x]].size() < kv[key[y]].size()) swap(x, y);
      long long int xx = ceil(dia[key[x]] / 2.0) + ceil(dia[key[y]] / 2.0) + 1;
      dia[key[x]] = max(max(dia[key[x]], dia[key[y]]), xx);
      long long int z = key[y];
      for (auto j : kv[z]) {
        kv[key[x]].push_back(j);
        key[j] = key[x];
      }
      kv[z].clear();
    }
  }
}
