#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 100;
vector<int> adj[maxn], com;
int h[maxn], ans[maxn], par[maxn];
bool mark[maxn];
int dfs(int v, int p = -1) {
  if (!mark[v]) com.push_back(v);
  mark[v] = true;
  if (p == -1) h[v] = 0;
  int ret = v;
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (u - p) {
      h[u] = h[v] + 1;
      int ver = dfs(u, v);
      if (h[ver] > h[ret]) ret = ver;
    }
  }
  return ret;
}
int root(int v) { return (par[v] < 0 ? v : par[v] = root(par[v])); }
void merge(int v, int u) {
  if ((v = root(v)) == (u = root(u))) return;
  if (par[v] > par[u]) swap(v, u);
  int New = (ans[v] >> 1) + (ans[v] & 1) + (ans[u] >> 1) + (ans[u] & 1) + 1;
  ans[v] = max(max(ans[v], ans[u]), New);
  par[v] += par[u];
  par[u] = v;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  while (m--) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  memset(par, -1, sizeof par);
  for (int i = 0; i < n; i++)
    if (!mark[i]) {
      com.clear();
      int ver = dfs(dfs(i));
      for (int j = 1; j < com.size(); j++) merge(i, com[j]);
      ans[i] = h[ver];
    }
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int v;
      cin >> v;
      v--;
      cout << ans[root(v)] << '\n';
    } else {
      int v, u;
      cin >> v >> u;
      v--, u--;
      merge(v, u);
    }
  }
  return 0;
}
