#include <bits/stdc++.h>
using namespace std;
const int N = 5 * 100007;
int par[N], _rank[N], mx, mx_v, diameter[N], used[N];
vector<int> adj[N];
void dfs(int v, int d, int p) {
  if (mx < d) {
    mx = d;
    mx_v = v;
  }
  for (auto x : adj[v])
    if (x != p) dfs(x, d + 1, v);
}
int cal_dia(int v) {
  mx = -1;
  dfs(v, 0, -1);
  mx = -1;
  dfs(mx_v, 0, -1);
  return mx;
}
int find_set(int x) {
  if (par[x] == x) return x;
  return par[x] = find_set(par[x]);
}
void _union(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (_rank[a] < _rank[b]) swap(a, b);
    par[b] = a;
    if (_rank[a] == _rank[b]) ++_rank[a];
  }
}
int rad(int val) { return (diameter[val] + 1) / 2; }
void __union(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (_rank[a] < _rank[b]) swap(a, b);
    par[b] = a;
    if (_rank[a] == _rank[b]) ++_rank[a];
    diameter[a] = max(rad(a) + rad(b) + 1, max(diameter[a], diameter[b]));
  }
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) par[i] = i;
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
    _union(a, b);
  }
  for (int i = 1; i <= n; ++i) {
    int pp = find_set(i);
    if (!used[pp]) {
      used[pp] = 1;
      diameter[pp] = cal_dia(pp);
    }
  }
  while (q--) {
    int a, b, c;
    scanf("%d%d", &c, &a);
    if (c == 1)
      printf("%d\n", diameter[find_set(a)]);
    else {
      scanf("%d", &b);
      __union(a, b);
    }
  }
}
