#include <bits/stdc++.h>
using namespace std;
long long n, m, q, x, y, parent, max_val, max_node, query, max_len;
list<long long> vec[300005];
long long visited[300005];
struct pend {
  long long ff, ss;
};
pend p[300005];
int find(int x) {
  if (p[x].ff != x) p[x].ff = find(p[x].ff);
  return p[x].ff;
}
void dfs(int node, int d, int t) {
  if (d > max_val) {
    max_val = d, max_node = node;
  }
  visited[node] = t;
  p[node].ff = parent;
  list<long long>::iterator it;
  for (it = vec[node].begin(); it != vec[node].end(); it++) {
    if (visited[*it] != t) {
      dfs(*it, d + 1, t);
    }
  }
}
void uni(int a, int b) {
  int xparent = find(a);
  int yparent = find(b);
  if (xparent == yparent) return;
  long long len = (p[xparent].ss + 1) / 2 + (p[yparent].ss + 1) / 2 + 1;
  max_len = max(len, max(p[xparent].ss, p[yparent].ss));
  p[xparent].ff = yparent;
  p[yparent].ss = max_len;
}
int main() {
  scanf("%lld %lld %lld", &n, &m, &q);
  for (int i = 0; i <= n; i++) {
    p[i].ff = i;
    p[i].ss = 0;
  }
  for (int i = 0; i < m; i++) {
    scanf("%lld %lld", &x, &y);
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (visited[i]) continue;
    parent = i;
    max_val = -1;
    dfs(i, 0, 1);
    max_val = -1;
    dfs(max_node, 0, 2);
    p[i].ss = max_val;
  }
  for (int i = 0; i < q; i++) {
    cin >> query;
    if (query == 1) {
      scanf("%lld", &x);
      y = find(x);
      cout << p[y].ss << endl;
    } else {
      scanf("%lld %lld", &x, &y);
      uni(x, y);
    }
  }
}
