#include <bits/stdc++.h>
using namespace std;
struct data {
  int x, y, next;
} e[600010];
int v[400010], dis[400010], f[400010], val[400010], head[400010];
int cnt, n, m, Q, x, y, opt, res, ne;
void Insert(int x, int y) {
  e[++cnt].x = x;
  e[cnt].y = y;
  e[cnt].next = head[x];
  head[x] = cnt;
}
int get(int x) { return f[x] == x ? x : f[x] = get(f[x]); }
void dfs(int pos, int fa, int d) {
  if (d > res) {
    res = d;
    ne = pos;
  }
  for (int i = head[pos]; i; i = e[i].next)
    if (e[i].y != fa) dfs(e[i].y, pos, d + 1);
}
int Get(int x) {
  res = 0, ne = x;
  dfs(x, -1, 0);
  res = 0;
  dfs(ne, -1, 0);
  return res;
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    int X = get(x), Y = get(y);
    if (X != Y) f[X] = Y;
    Insert(x, y);
    Insert(y, x);
  }
  for (int i = 1; i <= n; i++)
    if (f[i] == i) val[i] = Get(i);
  for (int i = 1; i <= Q; i++) {
    scanf("%d", &opt);
    if (opt == 1) {
      scanf("%d", &x);
      printf("%d\n", val[get(x)]);
    } else {
      scanf("%d%d", &x, &y);
      int X = get(x), Y = get(y);
      if (X != Y) {
        f[X] = Y;
        val[Y] =
            max(val[X], max((val[Y] + 1) / 2 + (val[X] + 1) / 2 + 1, val[Y]));
      }
    }
  }
}
