#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
const int N = 300007;
int n, m, q, par[N], size[N], len[N];
vector<int> G[N];
int dist[N];
int get(int u) { return par[u] == u ? u : par[u] = get(par[u]); }
void unite(int u, int v, bool flag = false) {
  u = get(u);
  v = get(v);
  if (u == v) return;
  if (size[u] < size[v]) swap(u, v);
  size[u] += size[v];
  par[v] = u;
  if (flag)
    len[u] = max(len[u], max(len[v], 1 + (len[u] + 1) / 2 + (len[v] + 1) / 2));
}
int bfs(int u, int &v, vector<int> &mas) {
  dist[u] = 0;
  queue<int> Q;
  Q.push(u);
  int maxi = -1;
  while (!Q.empty()) {
    u = Q.front();
    Q.pop();
    mas.push_back(u);
    if (dist[u] > maxi) {
      maxi = dist[u];
      v = u;
    }
    for (int i = 0; i < (int)(G[u]).size(); ++i) {
      int to = G[u][i];
      if (dist[to] == -1) {
        dist[to] = dist[u] + 1;
        Q.push(to);
      }
    }
  }
  return maxi;
}
void solve() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    par[i] = i;
    size[i] = 1;
    dist[i] = -1;
  }
  for (int i = 1; i <= n; ++i) {
    if (dist[i] == -1) {
      vector<int> mas;
      int u, v, d;
      d = bfs(i, u, mas);
      for (int j = 0; j < (int)(mas).size(); ++j) dist[mas[j]] = -1;
      mas.clear();
      d = bfs(u, v, mas);
      for (int j = 0; j < (int)(mas).size(); ++j) unite(i, mas[j]);
      len[get(i)] = d;
    }
  }
  while (q--) {
    int ty, u, v;
    scanf("%d", &ty);
    if (ty == 1) {
      scanf("%d", &u);
      printf("%d\n", len[get(u)]);
    } else {
      scanf("%d%d", &u, &v);
      unite(u, v, true);
    }
  }
}
int main() {
  cerr << fixed;
  cerr.precision(2);
  cout << fixed;
  cout.precision(9);
  solve();
  return 0;
}
