#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int read() {
  int x = 0, f = 1;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (f = -f);
  for (x = ch ^ 48; isdigit(ch = getchar());
       x = (x << 3) + (x << 1) + (ch ^ 48))
    ;
  return x * f;
}
template <class T>
T Max(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T Min(T a, T b) {
  return a < b ? a : b;
}
struct Edge {
  int to;
  Edge *nxt;
  Edge(int to, Edge *nxt) : to(to), nxt(nxt) {}
} * head[N];
void add(int x, int y) { head[x] = new Edge(y, head[x]); }
int n, m, q, len, vis[N], fa[N], c[N], g[N], d[N];
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
void dfs(int x, int f) {
  int m1 = 0, m2 = 0;
  for (Edge *i = head[x]; i; i = i->nxt) {
    if (i->to == f) continue;
    dfs(i->to, x);
    int tmp = d[i->to] + 1;
    d[x] = max(d[x], tmp);
    if (tmp > m1)
      m2 = m1, m1 = tmp;
    else if (tmp > m2)
      m2 = tmp;
  }
  g[x] = max(0, m1 + m2);
  len = max(len, g[x]);
}
void calc(int x) {
  len = 0;
  dfs(x, 0);
  c[x] = len;
}
int main() {
  n = read();
  m = read();
  q = read();
  for (int i = 1; i <= n; ++i) fa[i] = i;
  for (int i = 1, x, y; i <= m; ++i)
    x = read(), y = read(), add(x, y), add(y, x), fa[find(x)] = find(y);
  for (int i = 1; i <= n; ++i)
    if (fa[i] == i && !vis[i]) calc(i), vis[i] = 1;
  for (int i = 1, opt, x, y; i <= q; ++i) {
    opt = read();
    x = read();
    if (opt == 1) {
      printf("%d\n", c[find(x)]);
      continue;
    }
    y = read();
    x = find(x);
    y = find(y);
    if (x == y) continue;
    int tmp = max((c[x] + 1) / 2 + (c[y] + 1) / 2 + 1, max(c[x], c[y]));
    fa[find(x)] = find(y);
    c[find(x)] = tmp;
  }
  return 0;
}
