#include <bits/stdc++.h>
using namespace std;
const int maxn = 3 * 100000 + 100;
int n, m, q;
int dia[maxn], p[maxn];
int Find(int u) { return (p[u] == u ? u : p[u] = Find(p[u])); }
void merge(int u, int v, bool query) {
  int p1 = Find(u), p2 = Find(v);
  if (p1 == p2) return;
  if (dia[p1] < dia[p2]) swap(p1, p2);
  if (query)
    dia[p1] =
        max(max(dia[p1], dia[p2]), (dia[p1] + 1) / 2 + (dia[p2] + 1) / 2 + 1);
  p[p2] = p1;
}
bool vis[maxn];
vector<pair<int, int>> E;
vector<int> adj[maxn];
int x, maxd;
void dfs(int u, int p, int d, int color) {
  vis[u] = 1;
  for (auto v : adj[u])
    if (v != p and vis[v] == color) dfs(v, u, d + 1, color);
  if (d > maxd) {
    maxd = d;
    x = u;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) dia[i] = 0, p[i] = i;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    E.push_back({u, v});
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      x = i;
      dfs(i, i, 0, 0);
      maxd = 0;
      dfs(x, x, 0, 1);
      dia[i] = maxd;
      maxd = 0;
    }
  }
  for (auto x : E) merge(x.first, x.second, 0);
  for (int i = 0; i < q; i++) {
    int opt, u, v;
    cin >> opt;
    if (opt == 1) {
      cin >> u;
      cout << dia[Find(u)] << '\n';
    } else {
      cin >> u >> v;
      merge(u, v, 1);
    }
  }
}
