#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];
int nextInt() {
  int x = 0, p = 1;
  char c;
  do {
    c = getchar();
  } while (c <= 32);
  if (c == '-') {
    p = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * p;
}
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;
  n = nextInt();
  m = nextInt();
  q = nextInt();
  for (int i = 1; i <= n; ++i) par[i] = i;
  while (m--) {
    int a, b;
    a = nextInt();
    b = nextInt();
    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;
    c = nextInt();
    a = nextInt();
    if (c == 1)
      printf("%d\n", diameter[find_set(a)]);
    else {
      b = nextInt();
      __union(a, b);
    }
  }
}
