#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using pii = std::pair<long long, long long>;
using namespace std;
long long n, m, q, t, a, b, parent[300005], visited[300005], sz[300005],
    diameter[300005], last, ldist;
vector<long long> adj[300005];
class CCivilization {
 public:
  void solve(std::istream& in, std::ostream& out) {
    in >> n >> m >> q;
    for (long long i = (0); i < (n); i++) {
      adj[i].clear();
      visited[i] = 0;
      diameter[i] = 0;
      parent[i] = i;
      sz[i] = 0;
    }
    for (long long i = (0); i < (m); i++) {
      in >> a >> b;
      a--;
      b--;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    for (long long i = (0); i < (n); i++)
      if (!visited[i]) {
        last = ldist = -1;
        dfs(i, i, 0);
        diameter[i] = dfs2(last);
      }
    for (long long i = (0); i < (q); i++) {
      in >> t;
      if (t == 1) {
        in >> a;
        a--;
        a = getparent(a);
        out << diameter[a] - 1 << "\n";
      } else {
        in >> a >> b;
        a--;
        b--;
        combine(a, b);
      }
    }
  }
  void dfs(long long x, long long start, long long dist) {
    if (visited[x]) return;
    visited[x] = 1;
    if (dist > ldist) {
      last = x;
      ldist = dist;
    }
    parent[x] = start;
    sz[start]++;
    for (auto v : adj[x])
      if (!visited[v]) dfs(v, start, dist + 1);
  }
  long long dfs2(long long x) {
    if (visited[x] == 2) return 0;
    visited[x] = 2;
    long long best = 0;
    for (auto v : adj[x])
      if (visited[v] != 2) best = max(best, dfs2(v));
    return 1 + best;
  }
  long long getparent(long long x) {
    if (parent[x] == x) return x;
    return parent[x] = getparent(parent[x]);
  }
  void combine(long long u, long long v) {
    u = getparent(u);
    v = getparent(v);
    if (u == v) return;
    if (sz[u] < sz[v]) swap(u, v);
    parent[v] = u;
    sz[u] += sz[v];
    if (diameter[u] < diameter[v]) swap(diameter[u], diameter[v]);
    diameter[u] = max(diameter[u], ((diameter[u] / 2) + (diameter[v] / 2) + 2));
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  CCivilization solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
