#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long n, m, q;
vector<long long> adj[300005], are[300005];
long long depth[300005], dim[300005];
long long reg[300005], used[300005];
void dfs(long long at, long long fr, long long prt) {
  used[at] = 1;
  reg[at] = prt;
  are[prt].push_back(at);
  depth[at] = depth[fr] + 1;
  for (long long to : adj[at]) {
    if (used[to]) continue;
    dfs(to, at, prt);
  }
}
long long parent[300005], siz[300005];
void make(long long v) {
  parent[v] = v;
  siz[v] = 1;
}
long long head(long long v) {
  if (v == parent[v]) return v;
  return parent[v] = head(parent[v]);
}
void combine(long long a, long long b) {
  a = head(a), b = head(b);
  if (a != b) {
    if (siz[b] < siz[a]) swap(a, b);
    parent[b] = a;
    siz[a] += siz[b];
  }
}
void solve() {
  cin >> n >> m >> q;
  for (long long i = 0, u, v; i < m; i++) {
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  long long prt = 0;
  for (long long i = 0; i < n; i++) {
    if (used[i]) continue;
    dfs(i, i, prt);
    prt++;
  }
  long long root[prt];
  for (long long i = 0; i < prt; i++) {
    long long amx = 0, tmp = -1;
    for (long long j : are[i]) {
      if (depth[j] > amx) {
        amx = depth[j];
        tmp = j;
      }
    }
    root[i] = tmp;
  }
  for (long long i = 0; i < 300005; i++) {
    are[i].clear();
    depth[i] = used[i] = 0;
  }
  for (long long i = 0; i < prt; i++) {
    make(i);
    dfs(root[i], root[i], i);
  }
  for (long long i = 0; i < prt; i++) {
    for (long long j : are[i]) {
      dim[head(i)] = max(dim[head(i)], depth[j] - 1);
    }
  }
  long long h, x, y;
  while (q--) {
    cin >> h;
    if (h == 1) {
      cin >> x;
      x--;
      cout << dim[head(reg[x])] << '\n';
    } else {
      cin >> x >> y;
      x--, y--;
      long long hx = head(reg[x]), hy = head(reg[y]);
      if (hx != hy) {
        long long da = dim[hx], db = dim[hy];
        long long pa[2] = {da / 2, (da + 1) / 2};
        long long push_back[2] = {db / 2, (db + 1) / 2};
        long long fdim = max(pa[0] + pa[1], push_back[0] + push_back[1]);
        for (long long i = 0; i < 2; i++)
          for (long long j = 0; j < 2; j++) {
            fdim = max(fdim, pa[i] + push_back[j] + 1);
          }
        combine(hx, hy);
        long long fck = head(reg[x]);
        dim[fck] = fdim;
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
