#include <bits/stdc++.h>
using namespace std;
const int maxn = 3 * 1e5 + 10;
int n, m, a, q, u, v, par[maxn], num[maxn], ans[maxn], cnt, mark[maxn],
    max1[maxn], max2[maxn], color;
vector<int> G[maxn], topol;
void DFS(int u) {
  cnt++;
  par[u] = color;
  mark[u] = 1;
  for (int i = 0; i < G[u].size(); i++)
    if (!mark[G[u][i]]) DFS(G[u][i]);
  topol.push_back(u);
}
void solve() {
  for (int i = 0; i < topol.size(); i++) {
    int id = topol[i];
    mark[id] = 0;
    for (int j = 0; j < G[id].size(); j++) {
      int jd = G[id][j];
      if (mark[jd]) {
        max2[jd] = max(max2[jd], max1[id] + 1);
        if (max2[jd] > max1[jd]) swap(max1[jd], max2[jd]);
      }
    }
  }
  reverse(topol.begin(), topol.end());
  for (int i = 0; i < topol.size(); i++) {
    int id = topol[i];
    mark[id] = 1;
    for (int j = 0; j < G[id].size(); j++) {
      int jd = G[id][j];
      if (!mark[jd]) {
        if (max1[id] != max1[jd] + 1)
          max2[jd] = max(max2[jd], max1[id] + 1);
        else
          max2[jd] = max(max2[jd], max2[id] + 1);
        if (max2[jd] > max1[jd]) swap(max1[jd], max2[jd]);
      }
    }
  }
}
int pari(int s) {
  if (par[s] == s) return s;
  int k = pari(par[s]);
  par[s] = k;
  ans[s] = ans[k];
  return k;
}
void merg(int up, int vp) {
  if (pari(up) == pari(vp)) return;
  ans[par[up]] = max(max(ans[par[up]], ans[par[vp]]),
                     (ans[par[up]] + 1) / 2 + (ans[par[vp]] + 1) / 2 + 1);
  ans[par[vp]] = ans[par[up]];
  num[par[up]] += num[par[vp]];
  num[par[vp]] = num[par[up]];
  if (num[par[up]] > num[par[vp]])
    par[par[vp]] = par[up];
  else
    par[par[up]] = par[vp];
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  while (m--) {
    scanf("%d%d", &u, &v);
    u--, v--;
    G[u].push_back(v), G[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    if (mark[i]) continue;
    cnt = 0;
    if (!mark[i]) {
      color = i;
      DFS(i);
    }
    num[i] = cnt;
    solve();
    for (int j = 0; j < topol.size(); j++) ans[i] = max(ans[i], max1[topol[j]]);
    topol.clear();
  }
  while (q--) {
    cin >> a;
    if (a == 1) {
      scanf("%d", &u);
      u--;
      printf("%d\n", ans[pari(u)]);
    } else {
      scanf("%d%d", &u, &v);
      u--, v--;
      merg(u, v);
    }
  }
}
