#include <bits/stdc++.h>
using namespace std;
long long powm(long long base, long long exp, long long mod = 1000000007) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % mod;
    exp >>= 1, base = (base * base) % mod;
  }
  return ans;
}
long long addm(long long a, long long b) {
  long long tmp = a + b;
  if (tmp > 1000000007) tmp -= 1000000007;
  return tmp;
}
long long length[300005];
long long par[300005];
long long visited[300005];
vector<long long> vec[300005];
long long k, mx, temp;
long long paa(long long idx) {
  if (par[par[idx]] == idx) return idx;
  par[idx] = par[par[idx]];
  return paa(par[par[idx]]);
}
void dfs(long long idx, long long pa, long long tempx) {
  par[idx] = k;
  visited[idx] = 1;
  if (tempx >= mx) {
    mx = tempx;
    temp = idx;
  }
  for (auto &value : vec[idx]) {
    if (value == pa) continue;
    dfs(value, idx, tempx + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  long long i, j, t, m, n, res = 0;
  long long x, y, fa, fa1, fa2, q;
  cin >> n >> m >> q;
  for (long long i = 1; i < n + 1; i++) {
    par[i] = i;
  }
  for (long long i = 1; i < m + 1; i++) {
    cin >> x >> y;
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  for (long long i = 1; i < n + 1; i++) {
    if (visited[i]) continue;
    mx = 0, k = i;
    dfs(i, 0, 0);
    mx = 0, k = temp;
    dfs(temp, 0, 0);
    length[k] = mx;
  }
  for (long long i = 1; i < q + 1; i++) {
    cin >> t;
    if (t == 1) {
      cin >> x;
      fa = paa(x);
      cout << length[fa] << '\n';
    } else {
      cin >> x >> y;
      fa1 = paa(x);
      fa2 = paa(y);
      if (fa1 == fa2) continue;
      par[fa1] = fa2;
      length[fa2] = max((length[fa1] + 1) / 2 + (length[fa2] + 1) / 2 + 1,
                        max(length[fa1], length[fa2]));
    }
  }
  return 0;
}
