#include <bits/stdc++.h>
using namespace std;
int n, m, qu, fx, fy, len, x, y, q[300001], pos, hd[600001], dis[600001],
    d[600001], fl[600001], f[600001], u1, u2;
int find(int x) { return x == f[x] ? x : (f[x] = find(f[x])); }
struct point {
  int to, nxt;
} edge[600001];
int ans(int x) {
  d[x] = 0, fl[x] = x, q[q[0] = 1] = x;
  int yu = x;
  for (int i = 1; i <= q[0]; i++) {
    y = q[i];
    for (int u = hd[y]; u != 0; u = edge[u].nxt)
      if (fl[edge[u].to] != x) {
        fl[edge[u].to] = x;
        q[++q[0]] = edge[u].to, d[edge[u].to] = d[y] + 1;
        if (d[edge[u].to] > d[yu]) yu = edge[u].to;
      }
  }
  int y2 = yu;
  d[yu] = 0, q[q[0] = 1] = yu, fl[yu] = yu;
  for (int i = 1; i <= q[0]; i++) {
    y = q[i];
    for (int u = hd[y]; u; u = edge[u].nxt)
      if (fl[edge[u].to] != yu) {
        fl[edge[u].to] = yu, q[++q[0]] = edge[u].to, d[edge[u].to] = d[y] + 1;
        if (d[edge[u].to] > d[y2]) y2 = edge[u].to;
      }
  }
  return d[y2];
}
int main() {
  scanf("%d %d %d", &n, &m, &qu);
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    fx = find(x), fy = find(y);
    edge[++len].to = y, edge[len].nxt = hd[x], hd[x] = len;
    edge[++len].to = x, edge[len].nxt = hd[y], hd[y] = len;
    if (fx != fy) f[fx] = fy;
  }
  for (int i = 1; i <= n; i++)
    if (i == find(i)) dis[i] = ans(i);
  for (int i = 1; i <= qu; i++) {
    scanf("%d", &pos);
    if (pos == 1) {
      scanf("%d", &x);
      fx = find(x);
      printf("%d\n", dis[fx]);
    } else {
      scanf("%d%d", &x, &y);
      fx = find(x), fy = find(y);
      if (fx == fy) continue;
      u1 = dis[fx];
      u2 = dis[fy], f[fx] = fy, dis[fy] = (u1 + 1) / 2 + (u2 + 1) / 2 + 1;
      if (dis[fy] < u1) dis[fy] = u1;
      if (dis[fy] < u2) dis[fy] = u2;
    }
  }
  return 0;
}
