#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 3;
const int maxm = 1e6 + 3;
const int mod = 1e9 + 7;
const int oo = 1e9 + 5;
const long double pi = 3.141592653589793238462643383279502884;
void input() {
  if (fopen("abc"
            ".inp",
            "r")) {
    freopen(
        "abc"
        ".inp",
        "r", stdin);
    freopen(
        "abc"
        ".out",
        "w", stdout);
  }
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int n, m, q, r;
int h[maxn], dia[maxn], root[maxn];
vector<int> g[maxn];
pair<int, int> e[maxn];
void dfs(int u, int p) {
  if (r == -1 || h[u] > h[r]) r = u;
  for (int v : g[u]) {
    if (v != p) {
      h[v] = h[u] + 1;
      dfs(v, u);
    }
  }
}
int get_root(int i) { return root[i] == i ? i : root[i] = get_root(root[i]); }
int main() {
  input();
  cin >> n >> m >> q;
  for (int i = 1, u, v; i <= m; ++i) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
    e[i] = {u, v};
  }
  for (int i = 1; i <= n; ++i) root[i] = i;
  for (int i = 1; i <= m; ++i) {
    int u = get_root(e[i].first), v = get_root(e[i].second);
    if (u == v) continue;
    root[v] = u;
  }
  memset(h, -1, sizeof(h));
  for (int i = 1; i <= n; ++i) {
    if (h[i] == -1) {
      h[i] = 0;
      r = -1;
      dfs(i, 0);
      int rt = r;
      h[r] = 0;
      r = -1;
      dfs(rt, 0);
      dia[get_root(i)] = h[r];
    }
  }
  int t, u, v;
  while (q--) {
    cin >> t;
    if (t == 1) {
      cin >> u;
      cout << dia[get_root(u)] << "\n";
    } else {
      cin >> u >> v;
      int ru = get_root(u), rv = get_root(v);
      if (ru != rv) {
        root[rv] = ru;
        dia[ru] =
            max({dia[ru], dia[rv], (dia[ru] + 1) / 2 + (dia[rv] + 1) / 2 + 1});
      }
    }
  }
  return 0;
}
