#include <bits/stdc++.h>
using namespace std;
vector<int> v[300005];
int p[300005], I, D, diam[300005];
bool first[300005];
void dfs(int x, int par, int d) {
  if (D < d) D = d, I = x;
  for (int j = 0; j < v[x].size(); j++) {
    int to = v[x][j];
    if (to == par) continue;
    dfs(to, x, d + 1);
  }
}
int P(int x) {
  if (p[x] == x) return x;
  return p[x] = P(p[x]);
}
void dsu(int u, int v) {
  int up = P(u), vp = P(v);
  if (up == vp) return;
  if (up < vp) swap(up, vp);
  p[up] = vp;
  diam[vp] =
      max(max(diam[up], diam[vp]), (diam[up] + 1) / 2 + (diam[vp] + 1) / 2 + 1);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    dsu(a, b);
    v[a].push_back(b), v[b].push_back(a);
  }
  int N = 0;
  for (int i = 1; i <= n; i++) {
    if (first[p[i]]) continue;
    first[p[i]] = 1;
    ++N;
    I = 0, D = 0;
    dfs(i, i, 0);
    D = 0;
    dfs(I, I, 0);
    diam[i] = D;
  }
  while (q--) {
    int tp;
    cin >> tp;
    if (tp == 1) {
      int x;
      cin >> x;
      cout << diam[P(x)] << "\n";
    } else {
      int a, b;
      cin >> a >> b;
      dsu(a, b);
    }
  }
}
