#include <bits/stdc++.h>
using namespace std;
const long long maxN = 3e5 + 7, MOD = 1e9 + 7, INF = 1e9 + 7, N = 1e6 + 17,
                sqr = 75;
long long n, m, q, par[maxN], now, cur, dis[maxN], x, y, ans[maxN], type,
    h[maxN];
vector<long long> a[maxN];
bool v[maxN];
void dfs(long long s, long long p) {
  v[s] = true;
  par[s] = p;
  for (long long i = 0; i < a[s].size(); i++) {
    if (!v[a[s][i]]) {
      dis[a[s][i]] = dis[s] + 1;
      if (dis[a[s][i]] > dis[now]) now = a[s][i];
      dfs(a[s][i], p);
    }
  }
}
void Dfs(long long s, long long p) {
  for (long long i = 0; i < a[s].size(); i++) {
    if (a[s][i] != p) {
      dis[a[s][i]] = dis[s] + 1;
      if (dis[a[s][i]] > dis[now]) now = a[s][i];
      Dfs(a[s][i], s);
    }
  }
}
long long find_par(long long x) {
  if (par[x] != x) par[x] = find_par(par[x]);
  return par[x];
}
void merge(long long x, long long y) {
  if (h[x] > h[y]) swap(x, y);
  par[x] = y;
  h[y] += (h[x] == h[y]);
  ans[y] =
      max(ans[y], max(ans[x], ((ans[x] + 1) / 2) + ((ans[y] + 1) / 2) + 1));
}
int main() {
  cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (long long i = 1; i <= n; i++) par[i] = i;
  for (long long i = 1; i <= m; i++)
    cin >> x >> y, a[x].push_back(y), a[y].push_back(x);
  for (long long i = 1; i <= n; i++) {
    if (!v[i]) {
      now = i;
      dfs(i, i);
      cur = now;
      dis[now] = 0;
      Dfs(cur, 0);
      ans[i] = dis[now];
    }
  }
  while (q--) {
    cin >> type;
    if (type == 1) {
      cin >> x;
      cout << ans[find_par(x)] << "\n";
    } else {
      cin >> x >> y;
      x = find_par(x);
      y = find_par(y);
      if (x != y) merge(x, y);
    }
  }
  return cout << "\n", 0;
}
